JeevaRekha
JeevaRekha

Reputation: 413

How to stop restarting node.js server when particular file changes

Im using a package called "sp-pnp-node". Whenever Im running this file, new "private.json" file would create on the root folder.If I run this file again and again private.json file getting overwriting. So my node server got restarting everytime.

What i need is, is there any way to prevent restart node.js server when this file private.js getting save?.

Upvotes: 3

Views: 8615

Answers (1)

AJS
AJS

Reputation: 2023

You need to add this config to your package.json, just add a directory or a file pattern to nodemonConfig in your package.json to ignore them. So, whenever there are any changes in the directory or file pattern that is ignored nodemon won't restart your server.

Sample package.json

{
    "name": "nodemon",
    "homepage": "http://nodemon.io",
    "...": "... other standard package.json values",
    "nodemonConfig": {
                        "ignore": ["*.json"]
                     }
}

take a look at the documentation for more information.

Upvotes: 6

Related Questions