-1

Hi i want to know that how to run angular application permanently. means if i run the npm start command on local server. then after it gives a url with port like localhost:4200. but when i close the terminal then my project not run. Same thing happen with me on live server when i run my command through putty. ng serve --host {ipadddress}. then it gives me a URL like mysiteip:4200. but when i close putty my site not run. i want to know that how to run angular application permanently.

DobleL
  • 3,808
  • 14
  • 20
Irshad
  • 35
  • 2
  • 7

3 Answers3

0

You could just send process into background by adding &

asdfgh
  • 2,823
  • 4
  • 21
  • 26
0

You can use

forever start node_modules/@angular/cli/bin/ng serve --host {ip_address or domain} --prod

Reference - https://github.com/angular/angular-cli/issues/4951

Instead of this, You can build your app and just drop everything you got in dist folder of your angular app into the directory of the hosting platform.

Krishna
  • 154
  • 4
  • 14
0

I would recommend the screen command on linux/unix systems

screen
// New shell opens

ng serve --host {ipadddress}
// Now putty can be closed

This is a terminal that persists and can be continued.

screen -r
// Lists all active screen sessions

screen -r SCREEN_TTY_NO 

But I would advise to not use this in a productive environment.

Bernhard
  • 4,855
  • 5
  • 39
  • 70