reitit

grzm 2024-04-02T15:15:34.252999Z

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?

wevrem 2024-04-05T12:45:04.775449Z

What do you determine after reading the docs?

grzm 2024-04-05T13:05:31.197799Z

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

wevrem 2024-04-02T16:35:50.524819Z

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)

grzm 2024-04-02T16:51:39.170399Z

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

Stig Brautaset 2024-04-04T09:58:02.914449Z

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

wevrem 2024-04-04T21:22:52.767159Z

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

grzm 2024-04-04T21:40:17.918319Z

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