Closed felkerch closed 4 years ago
Amphora currently attaches route-specific middleware by adding two Layers to the router: one for the middleware and then one for the renderer. This PR adds them to the same layer. Basically this is the diff:
- router.use(path, middleware); - router.get(path, renderer); + router.get(path, [middleware, renderer]);
You'll see different behavior if your middleware makes changes to the request (we change the URL for pagination).
The interface for adding routes to a site remains the same:
module.exports.routes = [ { path: "/:name", middleware: [fn] }, ... ]
Amphora currently attaches route-specific middleware by adding two Layers to the router: one for the middleware and then one for the renderer. This PR adds them to the same layer. Basically this is the diff:
You'll see different behavior if your middleware makes changes to the request (we change the URL for pagination).
The interface for adding routes to a site remains the same: