Nodemon is a utility that will monitor for any changes in your source and automatically restart your server. Perfect for development. Install it using npm.
Install nodemon
$ npm install -save nodemon
Add start script in package.json
"scripts": {
"start-debug": "NODE_ENV=local nodemon index.js",
},
Start node with debugging mode
$ npm run start-debug
> stock-sever@1.0.0 start-debug
> NODE_ENV=local nodemon index.js
[nodemon] 2.0.6
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node index.js`