I need to deal with routes like the following
[["/api/items/:id"
[".json" ::show]
["/details.json" ::details]]]
Is this possible with reitit?The above results in a multiple-terminators exception at compile-time
you need to revert to linear-router for that to work, e.g.
(def r
(r/router
["/api/items/{id}"
[".json" ::show]
["/details.json" ::details]]
{:router r/linear-router}))
(r/routes r)
;[["/api/items/{id}.json" {:name :user/show}]
; ["/api/items/{id}/details.json" {:name :user/details}]]e.g. matches the routes from top-down, so they can be anything. First match wins.
just bit slower, that’s all.
also, I used the {} path parameter syntax here, more obvious where the path-parameter starts and ends. Should work with the normal : style too.
Is there a way to mix routers? So like /api/items being a linear like you suggest but the rest being "default" (which i assume is more efficient)?