Fork me on GitHub

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


Yeah, path-params are viable for that. Can I somehow access them out of the routes definition? For example get the params of the currently set route.


Just found I could use match-by-path and then extract the coerced parameters.


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]]}


So 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 (so if the route does not have :authorize, the authorization middleware is not mounted)