Fork me on GitHub
#clojuredesign-podcast
<
2020-03-07
>
markbastian18:03:55

Using reitit you can specify middlewares anywhere in your routing data structure. I thought I had a good example on hand, but I think that’s on my work repo. Here are a couple pointers to examples of how they use middlewares flexibly: • https://github.com/metosin/reitit/blob/master/examples/ring-swagger/src/example/server.clj shows how they do a stack of global middlewares. • https://metosin.github.io/reitit/ring/middleware_registry.html they show a middleware layered on at each location in a path. While it’s a cool example it did leave me a little confused the first time I saw it. Like jumping from concept to grad school in one step. You can basically add middleware at any endpoint (or in the middle) of your routing table with reitit. The guys said they do Compojure so they can probably post the equivalent.