Proposal: greater middleware control
Closed this issue · 1 comments
heaper commented
Our plugin currently applies the express.static
middleware to one or more routes (entry points) and then optionally applies additional middleware specified in the plugin config file. The issue with this is that some middleware (like express-interceptor
) needs to applied before the express.static
middleware. So we need a way to control if a particular middleware is applied before or after the static middleware. The most straightforward and flexible way I can think of doing this is to simply do away with the entryPoints
configuration option for this plugin and just treat everything as middleware (express.static
is itself middleware, after all). An example configiuration:
{
port: 3001,
currentDirectory: __dirname,
middleware: [
{
route: '/',
fn: myInterceptorMiddleware
},
{
route: '/',
fn: express.static('../patternlab')
},
{
route: '/api',
fn: myApiMiddleware
}
}
aladage commented
This was resolved in 1.3.7.