Home > Web Front-end > JS Tutorial > body text

How to use node.js to start running in the background forever

php中世界最好的语言
Release: 2018-05-24 09:29:10
Original
1577 people have browsed it

This time I will show you how to use node.js to start running forever in the background and use node.js to start running forever in the background. What are the precautions? The following is a practical case. Let’s take a look.

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
Copy after login

or

node index.js
Copy after login
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
Copy after login
Then save and change the suffix to bat

However, this is After startup, the cmd box is always there. If

exit, the node.js project will be closed.

At this time we need to use forever

##1 .First switch to the project directory

cd 你的项目路径
Copy after login

2.ThenInstall##

npm install forever -g
Copy after login

3. Start

forever start app.js
Copy after login

4. Close

forever stop app.js #关闭
Copy after login
I believe you have mastered it after reading the case in this article For more exciting methods, please pay attention to other related articles on the php Chinese website!

Recommended reading:

vue Nested Routing and 404 Redirect Implementation Method Analysis_vue.js


How to use Internationalization of your own js code

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!