javascript - Equivalent of window.locaton and window.pathname in NodeJS -
what equivalent window.location.protocol
, window.location.host
in nodejs/expressjs?
i'm trying redirect url site using third party api.
the nodejs api url.format(urlobject) method returns formatted url string derived urlobject
.
var url = require('url'); function getformattedurl(req) { return url.format({ protocol: req.protocol, host: req.get('host') }); } res.redirect(getformattedurl(req));
Comments
Post a Comment