I gave myself a learning assignment - create a nice website to be hosted from a Node.js server accessible to my home network. My base system is running Windows 7 and I want to give this website a custom domain, so that accessing it from other devices is easy.
I have edited my host file to add mydomain
to 127.0.0.1
- now http://mydomain:8080
works on the same machine, but different devices can’t access it (equivalent to localhost
, which makes sense that other devices can’t use it). Now I am thinking that I might need a way to make my network ip address static, then map that IP to “mydomain” in the host file.
Is this the best way to make a custom domain accessible, or is there a solution using JavaScript via Node.js/Express (framework)/HTTP where I can keep my IP address dymanic? I have read about using proxies, but might that yield unexpected behavior from my server?
Ideally I would prefer not to have to type the port either and just use something like http://mydomain
Node.js has os.networkinterfaces()
available to it - which you are able to iterate through and return the network IP. Maybe I just need a way to map the network IP to a custom domain?