How to deploy angular app to production

Issue

I’m a little uncertain about some Angular 5 aspects. I’ve developed an app and don’t know how to run it on production.

Currently I run my app using ng serve in NodeJS , but is it same in a production environment ?

thanks!

Solution

ng serve

ng serve is for development purpose. Check docs.

When using ng serve the compiled output is served from memory, not from disk.
This means that the application being served is not located on disk in the dist folder.

ng build

ng build –prod is for production purpose. Check docs.

ng build compiles the application into an output directory.
The build artifacts will be stored in the dist/ directory, inside the root directory of your angular app.

Jus copy the dist folder to any server like IIS or Node Express and your angular app is up and running.

To deploy you app using IIS check this and using Node Express check this.

Answered By – Shaiju T

Answer Checked By – Cary Denson (AngularFixing Admin)

Leave a Reply

Your email address will not be published.