I'm using Node.js and Express as backend to my app, and wish to upload a photo to facebook. I came across this method of uploading an image by url: https://developers.facebook.com/blog/post/526/
Now all I need to figure out is what is my own base url, so I can assemble the full address of mt photo (say /photos/12345 should be http://www.mydomain.com/photos/12345)
Is there any way to do so? some Node env variable perhaps?
Thank
Basically, you bind Node.js / Express to a port, and perhaps to an IP address. So your question comes down to:
Is it possible to find out just by an IP address which domain name it is used by?
And the answer to that is simply: No, unfortunately not.
Reason: You can bind several domain names to the same IP address. So all you could do is query the DNS server of your choice for a reverse-lookup of the IP address to get a list of domain names. If you are lucky, there is only one. If not, there are more.
And, as an additional problem: If your code does not explicitly bind itself to a specific IP address you do not even know which IP address to use - there will be more than one: At least a IPv4 one, loopback, probably IPv6, ... potentially more if there is more than one network card, ...
So, bottom line: If you have a lot of good luck, yes, but there is no reliable method that works under every circumstance.