nodejs--Tips----Supervisor

Source: Internet
Author: User

When developing the HTTP application implemented by node. JS, you will find that no matter how you modify that line of code, you must terminate the Nodejs and re-run it to be effective. This is because Nodejs only parses the script file the first time it is referenced to a part, and then accesses the memory directly, avoiding repeated loading. This design of NODEJS, while improving performance, is not conducive to the development of debugging, because we always want to see the effect in the development process immediately, instead of terminating the process and restarting it every time.

Supervisor can help you implement this feature, he will monitor your changes to the code, and automatically restart the Nodejs, using a simple method, first use NPM installation supervisor:

NPM install-g Supervisor

If you are a Linux or MAC, typing the above command directly is likely to have a permissions error because NPM needs to install supervisor to the system directory and requires administrator authorization to install it using the sudo npm install-g Supervisor command.

Next, use the Supervisor command to start App.js (the JS file for your HTTP request)

Supervisor App.js

The supervisor gadget can solve debugging problems in development.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.