29
loading...
This website collects cookies to deliver better user experience
start
(to start the application) and dev
(to start the development version). When using nodemon, it is recommended to create a npm script specifically for running the application during development, can be called dev
or development
or whatever you like, though dev
is mostly used. Creating scripts for specific environments is best practice for separating commands and avoid bugs."scripts": {
"start": "node index.js"
}
npm i -D nodemon
# OR
npm install --save-dev nodemon
--exec
flag to run an npm script whenever a file has changed."dev"
entry in the scripts field in package.json
."scripts": {
"start": "node index.js",
"dev": "nodemon --exec 'npm start'"
}
index.js
.npm run dev
and enjoy nodemon restarting your application on file changes. To manually restart your Node.js application you can type rs
in the command line.--ignore './folder/*.json'
.--exec
flag.--ignore
flag in nodemon, which prevents premature restarts of the application.