json-server

Resetting json-server to the contents of db.json


NOTHING I do will get json-server to acknowledge changes to the db.json file. After reading https://github.com/typicode/json-server/issues/177. I have tried clearing the cache and closed all browser connections etc. (which is a pain enough in a workflow...) but still the data and schema persists in its last used state.

REST calls change the data, and the changes can be seen, that is working fine. But I need to change the schema...

How do I get json-server to restart using what is in the db.json file??


Solution

  • In case it helps anyone else. I started json-server from the wrong folder, so it created and loaded a default db.json. I did not catch the warning

    Oops, db.json doesn't seem to exist
    Creating db.json with some default data
    

    on the very first startup. So I was altering the "wrong" file!!! Just a note in case anyone else gets caught out.