reitit

https://cljdoc.org/d/metosin/reitit/ https://github.com/metosin/reitit/
wegi 2020-07-30T10:20:37.388500Z

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?

worlds-endless 2020-07-30T21:10:52.388900Z

Would this work?

worlds-endless 2020-07-30T21:11:46.389400Z

Seems like you should be able to get it off the path params here

worlds-endless 2020-07-30T21:14:20.391600Z

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?

miikka 2020-07-31T07:03:46.392100Z

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-data

miikka 2020-07-31T07:04:53.392500Z

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

miikka 2020-07-31T07:07:09.392700Z

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)