Dara Vichit Dara Vichit - 1 year ago 195
Node.js Question

How to run node js file in background process on window server?

I was create a node.js project and upload it to my window server to provide api service for mobile application.
when I open command prompt and type

node app.js

It run correctly, but when I close the command prompt my node.js server was stop running.
How to make it still running when I close commend prompt?

example on Ubuntu I use command


How to do like this on window

Answer Source

You can make the process run in background using pm2

pm2 start app.js --watch

This will start the process and will also look for changes in the file. More about watch flag

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download