Fork me on GitHub
#reitit
<
2022-06-28
>
andrewmcveigh10:06:09

Is there some way to work around this issue I have with multiple terminators? I have the following (example) routes:

["/resource/{id}"       {:name :resource/page}]
["/resource/{id}.json"  {:name :resource/json}]
["/resource/{id}/thing" {:name :resource/thing}]
When compiling the routes I get:
Execution error (ExceptionInfo) at reitit.exception/exception (exception.cljc:19).
:reitit.trie/multiple-terminators
{:terminators (".json" "/thing"), :path "/resource/{id}"}
I cannot change the URIs of the things as this is an existing service that I'm trying to put reitit into.

ikitommi11:06:49

A good question. You could force a linear-router (via an option to reitit.core/router), but then you would lose a lot of perf, if that matters. The error is raised from the trie compilation (https://github.com/metosin/reitit/blob/3dff4c84aa748618cafc561e16ecdecf90ce87fb/modules/reitit-core/src/reitit/trie.cljc#L362), don't have a quick solution on how to change that. Long time since that code has been created/touched.

andrewmcveigh12:06:44

Thx, I'll try the linear router suggestion. Routing perf is probably not that big a deal in this service. 🙏

👍 1