How would I disable middleware (in metosin/compojure-api), for nested routes. For example, how do we remove parent-middleware application for the “child” context. In this case, I just want the child-middleware.
(context "parent" []
:middleware [parent-middleware]
...
(context "child" []
:middleware [child-middleware]
...))
So taking this a bit further, I was going through the source of composure.api.integration-test, and it seems that having nested :middleware definitions, is additive. http://metosin.github.io/compojure-api/doc/index.html
Does anyone know if there’s any way in compojure-api api documentation (declaratively or programmatically), that let’s you reset middlewares?
@twashing currently, there is no easy way, as it's based on Compojure and routing trees are programs and mw are applied in place.
with metosin/reitit
, it would be easy:
["/parent" {:middleware [parent-middleware]}
["/child {:middleware ^:replace [child-middleware]}]]
@ikitommi Hmm, very interesting. Thanks for the context. That helps a lot.