A request parameter is a path with a parameter in its path. A route that is registered with a parameter will be able to accept that parameter through the context.
Example
A route handler written like this
pub fn view(ctx: Context) -> Response(ResponseData){
use user_id <- context.then(ctx |> context.get_param("id"))
ctx
|> context.text("Hello, user " <> user_id)
}
A route registered like this
let routes = pluv |> pluvo.router
|> router.get("/user/:id", user.handler)
Implementation Details
We have everything we need to do this. We have a basic lcp (longest common part) implemented, but there's some issues with it.
It doesn't actually compare the number of equal parts existing between the request path and a registered path
We are searching the routes dict and not the nodes. The nodes are there so we can do stuff like this and traverse all the possible routes and speed up the search
Description
A request parameter is a path with a parameter in its path. A route that is registered with a parameter will be able to accept that parameter through the context.
Example
A route handler written like this
A route registered like this
Implementation Details
We have everything we need to do this. We have a basic lcp (longest common part) implemented, but there's some issues with it.