luminus

jeremy 2018-08-03T18:12:40.000392Z

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?

ikitommi 2018-08-03T19:01:07.000090Z

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.*)

jeremy 2018-08-03T19:08:36.000380Z

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

jeremy 2018-08-03T19:10:02.000133Z

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