Skip to content

Instantly share code, notes, and snippets.

@sahat
Created June 8, 2014 20:33
Show Gist options
  • Save sahat/75ae124be65fa3467ad6 to your computer and use it in GitHub Desktop.
Save sahat/75ae124be65fa3467ad6 to your computer and use it in GitHub Desktop.
using regex
app.use(function(req, res, next) {
var path = req.path.split('/')[1];
if (/auth|login|logout|signup|img|fonts|favicon/i.test(path)) {
return next();
}
req.session.returnTo = req.path;
next();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment