chovy chovy - 1 year ago 201
Javascript Question

how to get request path with express req object

I'm using express + node.js and I have a req object, the request in the browser is /account but when I log req.path I get '/' --- not '/account'.

//auth required or redirect
app.use('/account', function(req, res, next) {
if ( !req.session.user ) {
} else {

req.path is / when it should be /account ??

Answer Source

After having a bit of a play myself, you should use:


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download