Fork me on GitHub
#luminus
<
2018-08-03
>
jeremy18:08:40

How would you apply middleware to the contexts in this case instead of up a level where you pass service-routes api to a middleware? Or would you break the contexts out of the api?

ikitommi19:08:07

with compojure-api 2.* you can set :middleware option to api (besides context or endpoint. Something like:

(def service-routes
  (api
    {:middleware [...]}
    (context "/unsecured"
      :middleware [...]
      (GET "/ping []
        :middleware [...]
        (ok)))))
(defapi is deprecated in 2.*)

jeremy19:08:36

Hmm... I am using 1.1.12. 2.* is not out of alpha yet. Do you recommend updating?

jeremy19:08:02

I wonder if context has :middleware [print-middleware-3 print-middleware-4] from this https://github.com/metosin/compojure-api/wiki/Middleware