(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:
let about =
let path = s "about" /? nil in
let handler = function
| `GET -> Server.respond ...
| _ -> Server.respond `Method_not_allowed
in
path @--> handler
then all those go into one router with one_of and then matching done with the match'. That's okay, but it's a bit backwards from what I might expect (eg ASP.NET minimal api).
Example
```csharp
app.MapGet("/", () => "This is a GET");
app.MapPost("/", () => "This is a POST");
app.MapPut("/", () => "This is a PUT");
app.MapDelete("/", () => "This is a DELETE");
```
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 with match'.
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.
(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
```csharp app.MapGet("/", () => "This is a GET"); app.MapPost("/", () => "This is a POST"); app.MapPut("/", () => "This is a PUT"); app.MapDelete("/", () => "This is a DELETE"); ```
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.