Reputation: 349
When running my angular project, I want to change the localhost url to projectname.
localhost:4200 to projectName:4200
How should I proceed?
Upvotes: 0
Views: 1603
Reputation: 349
I solved, I added 127.0.0.1 projectName in the file "C: \ Windows \ System32 \ drivers \ etc \ hosts". Later, when I typed "ipconfig / flushdns" at the command line, I made "ng serve --host projectName" again and my project worked on projectName: 4200.
Upvotes: 0
Reputation: 1125
When you start the serve with ng serve
, just add host
:
ng serve --host="projectName"
.
Here are all parameters accepted by serve
: Angular ng serve Docs
IMPORTANT
This implies that you cannot serve the app if you don't have any address with that name
Upvotes: 1