Mehmet S
Mehmet S

Reputation: 349

Angular change host "localhost" to "projectName"

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

Answers (2)

Mehmet S
Mehmet S

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

Shifenis
Shifenis

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

Related Questions