Restart node upon changing a file

后端 未结 8 686
轮回少年
轮回少年 2020-11-28 17:54

For someone who is coming from PHP background the process of killing node and starting it again after every code change, seems very tedious. Is there any flag when starting

相关标签:
8条回答
  • 2020-11-28 18:37

    Various NPM packages are available to make this task easy.

    For Development

    • nodemon: most popular and actively maintained
    • forever: second-most popular
    • node-dev: actively maintained (as of Oct 2020)
    • supervisor: no longer maintained

    For Production (with extended functionality such as clustering, remote deploy etc.)

    • pm2: npm install -g pm2
    • Strong Loop Process Manager: npm install -g strongloop

    Comparison between Forever, pm2 and StrongLoop can be found on StrongLoop's website.

    0 讨论(0)
  • 2020-11-28 18:43

    I use runjs like:

    runjs example.js
    

    The package is called just run

    npm install -g run
    
    0 讨论(0)
提交回复
热议问题