Quantcast
Channel: add middleware to all routes but a few - Stack Overflow
Browsing all 3 articles
Browse latest View live

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 Article



Answer 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 Article

add 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
Browsing all 3 articles
Browse latest View live


Latest Images