Reload Node Server When a File Changes with Nodemon
To reload a server when a file changes nodemon can be used. This solution is good enough for development servers, while better solutions are recommended for production servers, such as using pm2
Run a script with nodemon:
$ nodemon <script-file>
It is also possible to use it as an application script:
$ npm install --save-dev nodemon
Add these to package.json
:
"scripts": {
"start": "nodemon entry.js -devmode -something 1"
}
And then run:
$ npm run start
Was this useful to you?
Yes
No
Tags: