-
Notifications
You must be signed in to change notification settings - Fork 16
nodemon
Konrad K Sobon edited this page May 4, 2017
·
1 revision
In order not to have to restart the node.js server every time we make a change by calling node app.js we can just use npm to install a package called nodemon.
Nodemon will then keep an eye on any changes to our files and restart the app.js for us automatically. It needs the package.json to have 'start' defined as node app.js.
{
"name": "mean-app",
"version": "1.0.0",
"description": "Mean stack application",
"main": "app.js",
"scripts": {
"start": "node app.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/ksobon/MEAN-app.git"
},
"keywords": [
"mean"
],
"author": "konrad",
"license": "ISC",
"bugs": {
"url": "https://github.com/ksobon/MEAN-app/issues"
},
"homepage": "https://github.com/ksobon/MEAN-app#readme",
"dependencies": {
"body-parser": "^1.17.1",
"express": "^4.15.2"
},
"devDependencies": {
"@types/node": "^7.0.16",
"mocha": "^3.3.0"
}
}
To avoid having nodemon restart node every time we make a change to some static resource we need to configure it by adding nodemon.json to root.
{
"ignore" : ["public/*"],
"verbose" : true
}
The above code will skip any changes to the public directory and its sub-directories.