Fork me on GitHub
Yehonathan Sharvit11:09:13

Is it possible to write a reitit middleware that adds a route?

Yehonathan Sharvit11:09:41

From what I tried, it seems than when a request doesn't match any route, the middlewares are not executed


@viebel reitit uses a route-first design - routing is done first, and only after that, the per-endpoint middleware/interceptor chain is executed. You can add mws on top of the router to effect all routes


and, yes, you can add routes in mw. But, you also need to re-create the router after that. or have a custom routing happen in a mw.


you can also nest routers to make it work similar to compojure, if that’s the thing: