Home  >  Article  >  Web Front-end  >  Node.js method to start running forever in the background

Node.js method to start running forever in the background

不言
不言Original
2018-07-04 10:50:181684browse

Today I will share with you a node.js deployment method to start running forever in the background. It has a good reference value and I hope it will be helpful to everyone.

We know that if you want to run the project after deployment, you need to use the command line

cd to the project directory and then execute

npm install

or

node index.js

Or use a bat file to execute

The method is to first create a txt file and write down the steps you need to perform

cd C:\Program Files\nodejs\wh
npm start

Then save and change the suffix to bat

However, this is After startup, the cmd box is always there. If you exit, the node.js project will be closed.

At this time we need to use forever

1. First switch to the project directory

cd 你的项目路径

2.Then install

npm install forever -g

3.Start

forever start app.js

4. Close

forever stop app.js #关闭

The above is the entire content of this article, I hope it will be helpful to everyone’s study, more related content Please pay attention to PHP Chinese website!

Related recommendations:

How to use Buffer to encode and decode binary data in Node.js

About nodejs development environment Configuration and use

The above is the detailed content of Node.js method to start running forever in the background. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn