This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-11-17
Channels
- # architecture (115)
- # asami (64)
- # aws (2)
- # babashka (65)
- # beginners (91)
- # calva (21)
- # clara (3)
- # cljdoc (5)
- # cljsrn (1)
- # clojure (331)
- # clojure-australia (15)
- # clojure-europe (16)
- # clojure-italy (7)
- # clojure-nl (8)
- # clojure-uk (10)
- # clojurescript (10)
- # conjure (4)
- # core-typed (6)
- # cryogen (12)
- # data-science (1)
- # datomic (9)
- # depstar (2)
- # emacs (1)
- # events (1)
- # figwheel-main (1)
- # fulcro (2)
- # graalvm (9)
- # helix (4)
- # java (45)
- # kaocha (4)
- # malli (14)
- # meander (4)
- # membrane (34)
- # mid-cities-meetup (6)
- # pedestal (3)
- # re-frame (7)
- # reitit (4)
- # shadow-cljs (4)
- # spacemacs (5)
- # sql (29)
- # tools-deps (22)
Morning 👋 It's that time, I'm actually going to understand how Ring works today.
I'm trying to teach myself reitit and realising an understanding of Ring would be helpful 🙂
You should be good, only weirdness to remember is middleware wraps from the inside out
Oh what do you mean?
So ring middleware is fairly simple, it follows the format:
(defn wrap-something [handler]
(fn [request]
(-> request
do-before
handler
do-after)))
So when this endpoint is called, it calls the do-before of wrap-third first, then wrap-second and wrap-first
Then when returning, it does the do-after of wrap-first, then wrap-second, then wrap-third
It’s not particularly difficult, it just took my head a little to get around when I had to write middleware
Right, I think I get the gist of it. I havent used ring before but I know the concept of middlewares with expressjs