Wednesday 9 November 2016

How to Start Angular Forever as Background process

Hey There,

Angular js process can be started forever using npm package named Forever


Forever is used to start Angular js script npm start in the background process.

Why we need forever package?

Whenever we deploy angular js code in linux environments and do npm start . it will bootstrap the angular js and works fine but when we disconnect the remote connection to linux it will terminate the process automatically. 

To avoid such termination while we connected to remote linux environment . we need to start the angular js forever. Forever npm package helps to do this and start the app in the background. 

Installation of Forever package globally in linux

  [sudo] npm install forever -g

Starting the App with Forever

To start the app, we need to specify the path where npm start script is present. Usually it present in package,json . Hence we need to specify that path.

forever start -c "npm start" /path/to/app/dir/
IF you wish to start from current directory of package.json. Use below command. 
forever start -c "npm start" ./

Hope This help you folks. Any doubts please comment.

No comments:

Post a Comment