I\'m working with expressjs and want to authenticate users for a login using sessions. The site/app should on one hand allow the user to browse and investigate different pro
You can wrap middleware in a function to black or whitelist certain urls. This is a whitelist example:
function allow(paths, fn) {
return function(req, res, next) {
if (~paths.indexOf(req.url)) {
return fn(req, res, next);
}
next();
}
}
You wrap it around your middleware like:
app.use(allow(['/bibliotek', '/registrer'], express.cookieParser()));
You can use the same technique for other middleware as well. This was based on a gist that the express author showed in irc.