AlexCouch / pluvo

Pluvo is a modern web framework purely in Gleam built ontop of mist
4 stars 0 forks source link

Default "route not found" handler #13

Closed AlexCouch closed 8 months ago

AlexCouch commented 8 months ago

Description

For some middleware to work, we need a default handler to be returned if a path is not present in the router. This means we could also allow users to customize what happens when a route isn't found as a custom handler.

For example, the static middleware needs to be called regardless if the path has an associated route or not. So returning a route not found handler could help with implementing the static middleware.

Technically, there already is a default "route not found" but it is not a handler, it is just a prebuilt response. See https://github.com/AlexCouch/pluvo/blob/master/src/pluvo.gleam#L37-L39