NodeJS: NPM Scripts and Nodemon
This process will create file package.json
file under your project, where you can define scripts.
Run npm init
under your project. Following file will be generated:
Now you can update this file.
You can then run your app with just npm start
.
But if you make some change to the app, you must still quit the app and restart it.
To automate this process we can use nodemon
. --save-dev
means that this package is used during development only.
After installing nodemon
you can change package.json
:
Then run your app with npm start
and it will now look for any change you make and restart app automatically.