Answer by Neo for add middleware to all routes but a few
If you are using express 3.x series you are out of luck here. You need to hack the middle ware to to check the the path.app.use(function(err, req, res, next){ if(canRouteSkipLogin(req.path) next();...
View ArticleAnswer by Peter Lyons for add middleware to all routes but a few
The only way I've been able to do this is to just explicitly code for it with a guard clause in the middleware itself. So the middleware always gets called, it checks req.path against the bypass regex,...
View Articleadd middleware to all routes but a few
how can I add middleware to all possible routes except for these that match a given expression?I know how to add a middleware to ones that match an expression:app.all('/test/*', requireLogin);but I...
View Article