nodejs supporting development tools nodemon

 After modifying the code, you need to restart Express applications required for the changes to take effect. If the code changes after each such operation must be repeated, is bound to affect the efficiency of development, this article will detail Nodemon, it will monitor all files in the project, once the file has changes, Nodemon will automatically restart the application

 

Installation and Use

  Global nodemon installation package, so that new applications can be created using Node.js Nodemon up and running

npm install -g nodemon

  After the installation is complete, Nodemon Express applications can be started, first close the application currently being executed, and then execute the command:

nodemon index.js

  By default, nodemon will automatically open index.js. So, you can use the following command

nodemon

  By Nodemon after starting the application, whether it is to modify the code, or install a new npm package, Nodemon will restart the application

 

Profiles

  Nodemon default (that is, the directory where the command execution nodemon) all files in the current directory will be listening, but in some cases, although the project files have changed, but do not need to restart the application Nodemon, how to make that file is not listening Nodemon it? Do not need to monitor files can be excluded by setting Nodemon configuration file, the new file server / nodemon.json, add code:

{
  "ignore": [
    "config.default.js"
  ]
}

  Nodemon profile is JSON file, by setting the ignore property value, a string array composed of a file name, file specifies that no monitor

 

Manual restart

  Sometimes may Nodemon still running when the need to manually restart it, in this case do not need to shut down Nodemon running process and then restart Nodemon, enter rs as long as two characters in a terminal window Nodemon command to run, and then press the Enter key, you can restart the Nodemon

rs 

  Of course, Nodemon not only specialized services in Node.js applications, it can also be used in applications other language development

Published 219 original articles · won praise 347 · views 340 000 +

Guess you like

Origin blog.csdn.net/jiang7701037/article/details/97685436