Angular 6 on ng serve change localhost:4200 to domain:name

12,729

ng serve --open is only for local development purpose - it is not a matter, it can be changed when you deploy your project

ng build --prod --deploy-url=[bind the domain url]

This will provide you the build based on the domain you specified and you can deploy your builds in the specific location

To change the ng serve port you can use ng serve --open --port=4500 any port id specified.

Share:
12,729
Abhinav Sharma
Author by

Abhinav Sharma

Updated on June 05, 2022

Comments

  • Abhinav Sharma
    Abhinav Sharma almost 2 years

    In angular 6 we use ng serve to start angular server with ng server --open, den in browser we get http://localhost:4200,

    What I want :- When I ng serve the angular 6 project, should show directly go to http://domain-name.com

    So I want to run angular project directly to domain name can it be possible.

    On FRESH PROJECT