I'm using now.js and there's this line that refers to localhost. In order for someone to access the server outside I need to modify localhost to be the current external ip of my computer(my ip is dynamic). Is there any way to detect the current external ip from the script?
window.now = nowInitialize("//localhost:8081", {});
You could ask an external service like this one (which is nice because it returns it without formatting).
To use it, you could use Node's built in
http
module:Keep in mind that external services can go down or change — this has happened once already, invalidating this answer. I've updated it, but this could happen again…