reitit 2024-04-02

Hello! Is there a standard way of getting the name of a route from the request? What I'm doing right now is (get-in req [:reitit.core/match :data :name]). Is that stable? Is there a more idiomatic way to get the route name from the request?

What do you determine after reading the docs?

I didn’t find anything when I was looking at the docs that definitely indicated either way. I could have missed it, though.

That’s the same pattern I’ve followed. Not to get the :name but instead some other custom data I stuffed into the :data of the routes.

(-> request :reitit.core/match :data ::level)

Cheers. At least I know I'm not alone 🙂

We use (-> request :reitit.core/match :template) which is great to keep customer identifiers out of logs and metrics.

:template gives you the pattern of the URI, right? But doesn’t help you with :name or other custom data stashed in the route.

My primary concern is whether :retit.core/match (and the path [:reitit.core/match :data]) is considered an implementation detail subject to change or something I, as a library user, am expected to be able to rely on.

1