How to restart service in nodejs

青灯夜游
Release: 2022-01-25 14:33:10
Original
7132 people have browsed it

Nodejs method to restart the service: 1. Press the "Ctrl C" key in the command console to terminate the currently running code; 2. Execute the "node filename.js" command to restart the node service.

How to restart service in nodejs

The operating environment of this tutorial: linux5.9.8 system, nodejs version 12.19.0, DELL G3 computer.

How to restart the Node service

1. Press Ctrl C in the command console to terminate the currently running code

2. Then continuenode filename.js, you can restart node.js


Automatically restart the Node service

Node Supervisor was originally used to automatically restart the Node.js application on the server when it crashes. Of course, it can also monitor changes in your project's js files and automatically restart to facilitate debugging.

Install sudo npm install supervisor -g, or use sudo cnpm install supervisor-g.

Usage:

1. Turn off the previously opened node service.

2. Then use the command: supervisor yourApp.js in the project path to open Supervisor. It will start the node service and continuously detect file changes. When the content of the JS file is modified, the service will be automatically restarted, which is very convenient.

For more node-related knowledge, please visit: nodejs video tutorial!

The above is the detailed content of How to restart service in nodejs. 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!