Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ganeshkbhat/6024a3e1eebf9aa3449aba90e0a4a215 to your computer and use it in GitHub Desktop.
Save ganeshkbhat/6024a3e1eebf9aa3449aba90e0a4a215 to your computer and use it in GitHub Desktop.
ExpressJS Series: Difference the req.baseUrl req.originalUrl req.path
app.use('/admin', function(req, res, next) {
/* GET 'http://www.example.com/admin/new' */
console.log(req.originalUrl); // '/admin/new'
console.log(req.baseUrl); // '/admin'
console.log(req.path); // '/new'
next();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment