expressjs: get requested url

后端 未结 4 1905
情深已故
情深已故 2021-02-19 07:02

I want to get the url the client has requested out of the request.

Currently I use:

var requestedUrl = req.protocol + \'://\' + req.host + \':3000\' + re         


        
4条回答
  •  感情败类
    2021-02-19 07:33

    Is this that you are looking for ?

    req._parsedUrl.pathname
    

    You should, if you don't already use:

    var util = require('util'); // core module
    console.log(util.inspect(req));
    

    To debug find out that kind of data.

提交回复
热议问题