SyntaxFix
Write A Post
Hire A Developer
Questions
In Express 4.x you can use req.hostname, which returns the domain name, without port. i.e.:
req.hostname
// Host: "example.com:3000" req.hostname // => "example.com"
See: http://expressjs.com/en/4x/api.html#req.hostname