Forever + Nodemon running together

后端 未结 8 1472
刺人心
刺人心 2020-12-07 10:04

Is there any way to have both of this packages running together?

So basically I want to have best from both worlds. Running server automatically (and restarting when

8条回答
  •  被撕碎了的回忆
    2020-12-07 10:14

    I'm using forever-service . . .

    This is what worked for me. It does the following: everytime a json or raml file in the applications dist/assets folder is modified, wait 10 seconds and then restart the node app (server.js script):

    $ forever-service install raml --script server.js -f " -c nodemon" -o " --delay 10 --watch dist/assets -e json,raml --exitcrash" -e "PATH=/usr/local/bin:$PATH"
    

    Then I can run:

    $ service raml start|stop|restart|status
    

    I can also have the service start on server reboot with the chkconfig utility:

    $ chkconfig --add raml
    $ chkconfig raml on
    

提交回复
热议问题