This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-08-11
Channels
- # babashka (3)
- # beginners (70)
- # calva (15)
- # cider (34)
- # clara (10)
- # cljsrn (2)
- # clojure (28)
- # clojure-europe (21)
- # clojure-france (1)
- # clojure-uk (17)
- # clojuredesign-podcast (4)
- # clojurescript (51)
- # cursive (21)
- # data-science (1)
- # datalog (2)
- # datascript (2)
- # datomic (10)
- # emacs (5)
- # esprit (24)
- # expound (9)
- # figwheel-main (15)
- # fulcro (31)
- # graphql (3)
- # jobs-discuss (27)
- # keechma (2)
- # luminus (2)
- # malli (2)
- # minimallist (14)
- # nrepl (1)
- # off-topic (4)
- # pathom (1)
- # pedestal (8)
- # re-frame (10)
- # reagent (5)
- # reitit (2)
- # rewrite-clj (54)
- # sci (1)
- # shadow-cljs (34)
- # spacemacs (12)
- # sql (17)
- # vim (16)
- # web-security (1)
What's the recommended way of setting up a route with an interceptor for body-params
? I have this:
["/api/users"
:post [(body-params/body-params)]
;user-handler
:route-name :user-handler
]
with my handler:
(defn user-handler
[{:keys [headers params json-params path-params] :as request}]
{:status 200 :body "/api/users"})
but doesn't seem to workfigured this out
When you compose interceptors, whats the preferred pedestal way? Many interceptors or few interceptors? Example: 1. "light weight interceptors"
(conj common-interceptors
error-handler
coerce-create-transaction-request
with-jdbc-transaction-interceptor!
get-current-user-interceptor!
get-current-system-status-interceptor!
validate-user-balance-interceptor
save-transaction-interceptor!
notify-booking-system-interceptor!)
2. "heavy-weight-interceptors"
(conj common-interceptors
error-handler
coerce-create-transaction-request
handle-create-transaction-interceptor)
I tend to prefer small interceptors where each focuses on a single responsibility but I suppose it depends on context
👍 3
To me, having small interceptors which focus on a single responsibility makes things more explicit
A downside could be performance. E.g., 10 round-trips to the database, instead of just 1
indeed isak, one always has to think about roundtrips 🙂