0
app.post('/sQ', function (req, res){
            var url = req.get('host') + ' '  +req.url;
    console.log('url is ' +url);
            res.send(url);
});

The above will print www.example.com/sQ. In place of /sQ the actual URL may be different.

If the above is a REST call instead of the actual url. How can you refer the actual url?

For eg. Angular can make following call from any url.

$http({method: 'get', url: '/sQ'}).
    success(function(data, status, headers, config) {
      console.log(data);      
    }
  });
Sangram Singh
  • 7,161
  • 15
  • 50
  • 79

0 Answers0