Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

express request path

// GET 'http://www.example.com/admin/new?a=b'
app.get('/admin', (req, res, next) => {
  req.originalUrl; // '/admin/new?a=b' (full path with query string)
  req.baseUrl; // '/admin'
  req.path; // '/new'
  req.baseUrl + req.path; // '/admin/new' (full path without query string)
});
 
PREVIOUS NEXT
Tagged: #express #request #path
ADD COMMENT
Topic
Name
2+4 =