Hi there. If i have a frontend route foo/:some-id
where the browser is currently pointed to and I want to navigate to foo/:some-id/bar
is there any way, that reitit can be configured to just keep the same :some-id
without me having to specify it for push-state
?
Would this work?
Seems like you should be able to get it off the path params here
Back-end, Compojure-style. Suppose I have "/foo" {:get myfn}
and it is covered by a middleware, but I want the :post
on it to have different middleware (or one less middleware). How do I get these different profiles?
Hmm, you could use ^:replace
for middleware, although it's not that handy f you just want to remove one middleware.
"/foo" {:get myfn, :post {:handler otherfn, :middleware ^:replace [[wrap-middleware1] [wrap-middleware2]]}
https://cljdoc.org/d/metosin/reitit/0.5.5/doc/basics/route-data#nested-route-dataSo normally if you specify :middleware
for :post
, the nesting appends it to the middleware you've defined above, but with :replace
it instead replaces the middleware stack
If these are middleware written by you, well, I often solve this by adding a way to disable the middleware with route data, like the first example here https://cljdoc.org/d/metosin/reitit/0.5.5/doc/ring/compiling-middleware#require-keys-on-routes-at-creation-time (so if the route does not have :authorize
, the authorization middleware is not mounted)