I\'m still learning Node JS and javascript and have an app. I have a configuration file where I need to grab the hostname of the server on Ubuntu 12.04
I tried some
You can only get the same host name you would get from window.location.hostname if you're running a server with http.createServer. In that case, the host name is one of the properties of the request object:
request.headers.host
I'd love to take credit for this answer, but I'm only here because I didn't know the answer. I found the answer posted at this SO answer.