AlexCouch / pluvo

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

Middleware is applied twice #23

Closed AlexCouch closed 8 months ago

AlexCouch commented 8 months ago

Description

Middleware is applied to routers twice. This is because we are applying middleware when pluvo.enable, router.enable, and router.add_route are called. So instead of applying middleware in the request handler, we are only needing to apply the middleware during setup, which helps simplify the actual request handling.

Also, the middleware should be applied to the route not found handler so that if a route isn't found, middleware can still occur (such as logging or static handling).