Reputation: 1673
I want to change host name for testing purpose. I have tried ng serve --host 0.0.0.0 but app again runs on localhost:4200. Is there a way that app runs on different host name (word) in browser?
Upvotes: 3
Views: 12947
Reputation: 291
Upvotes: 6
Reputation: 4391
If you're on Mac or Linux and just for local testing, you can edit /etc/hosts
and add your own dns mapping. I'm sure you can do something similar on Windows.
For example you can add adding mysite
to your hosts file:
127.0.0.1 mysite
Then you can access your app by going to http://mysite:4200
.
Note that if making changes to your hosts file don't appear to work you may need to either reboot or make your OS reload your hosts file. See the bottom of this page for more information: https://www.imore.com/how-edit-your-macs-hosts-file-and-why-you-would-want
Upvotes: 7