0

Let's say I'm running my server on the url test.us-west-1.elasticbeanstalk.com. How can I get this URL from Node.js? Or the Elastic IP?

server.listen(port, error => {
    if(error){
        return console.error(error);
    }
    var CURRENT_DOMAIN = server.listen.url; // <--- should return 'test.us-west-1.elasticbeanstalk.com' or the Elastic IP
    console.log(`Server running on port: ${port} -- ${CURRENT_DOMAIN}`);
});
Vardan Betikyan
  • 354
  • 5
  • 20
  • 1
    Does the question have an answer to your problem? https://stackoverflow.com/questions/3653065/get-local-ip-address-in-node-js – Max Apr 26 '21 at 08:48
  • @Max It returns the IP address, albeit the wrong one. I'm using AWS as my provider. I've rephrased my question – Vardan Betikyan Apr 26 '21 at 09:02

0 Answers0