0

So I was making a chat like program in js, and I was using nodemon to run It. I have that the chat autosaves into the JSON. However when It does that the whole nodemon server restars, creating a problem. Is there a way to avoid this?

Thanks

SGTMM
  • 31
  • 5

1 Answers1

0

Nodemon allows you to set a configuration in nodemon.json (root of your project directory), or you can call it with nodemon index.js --config mynodemonconfig.json

add your folder of json to your ignore or remove "json" from ext (not recommended)

{
    "ext": "ejs js styl pug json", 
    "ignore": [
        ".git",
        "node_modules/*"
    ]
}
Cody G
  • 8,368
  • 2
  • 35
  • 50
  • Wait where do i find the nodemon.json. I have a package.json but the code you mentioned up here isn't featured there – SGTMM Mar 22 '23 at 18:09
  • you have to create `nodemon.json` – Cody G Mar 22 '23 at 19:12
  • Ok, do I have to create o put it in a specific folder? – SGTMM Mar 22 '23 at 19:33
  • "scripts": { "devStart": "nodemon server.js --ignore login.json" }, This worked thanks still – SGTMM Mar 22 '23 at 19:39
  • normally you'd put it where you are calling `nodemon` and it would automatically pick it up, alternatively you can specify the path using `--config /myfolder/myconfig.json` – Cody G Mar 22 '23 at 22:08