Replies: 1 comment 1 reply
-
Hi! Moving this to a GitHub discussion instead of an issue. The library indeed had support for HTTP verbs for a while. I ended up removing that mostly because of a lack of consensus around a http types library in the OCaml ecosystem 😅 That, and as you mention there can be multiple different approaches one can take for this use-case. In the past I've used a couple of different approaches to deal with these scenarios: Using a map with http verbs as keys and
|
Beta Was this translation helpful? Give feedback.
-
(This is more of a question, so perhaps it would be better on discuss forum or something like that.)
I see in this pull request (https://github.com/anuragsoni/routes/pull/92/files) that there was once support for also matching on http method/verb. What is the recommended way to handle the http verbs now?
I have a bunch of routes that look like this:
then all those go into one router with
one_of
and then matching done with thematch'
. That's okay, but it's a bit backwards from what I might expect (eg ASP.NET minimal api).Example
Alternatively, I could imagine something where you might have a associative map that maps verbs to a router (each set up with
one_of
, then you have some set up where you match first on the verb, and then do the route matching withmatch'
.I suppose it is a mostly matter of personal preference, but I wanted to get your input since at one time this library also handled the http verbs.
Beta Was this translation helpful? Give feedback.
All reactions