Reputation: 3464
I've created a node.js
app. When it runs my mobile phone can connect to it using address 192.168.1.5. In other words, when I open a browser on my phone and enter 192.168.1.5 I get a welcome page served by the app running on my PC.
The problem is that the IP address is not human friendly. Is there a way to access my app by an alias? For example, http://myapp or something like this?
Upvotes: 0
Views: 3482
Reputation: 108841
Yes, these aliases are provided by the domain name service (DNS). You need to set up a hostname on DNS to point to your machine's local address.
Put that IP address into a DNS server.
Here's a free way to do that.
You can pay FreeDNS to register your own domain name and use that if you prefer.
There are all sorts of other ways to register a domain and then add address records to it, to translate from hostnames to IP addresses.
Edit If you were connecting to and from your desktop / laptop machine, you could add a hostname to your hosts
file. The hosts
file is itself a little DNS registry that's local to your machine. On windows it's at C:\Windows\System32\drivers\etc\hosts
. On *nix and mac it's at /etc/hosts
.
But, you are connecting to your app from a mobile device. Editing the hosts file in a mobile device is unreasonably difficult.
Upvotes: 1