Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resetting json-server to the contents of db.json

Tags:

json-server

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??

like image 524
kpollock Avatar asked Feb 20 '17 11:02

kpollock


People also ask

What is a JSON server?

JSON Server is a Node Module that you can use to create demo REST JSON services within a short span of minutes. All we need to do is have a JSON file as sample data. Let's learn more about how to install and set up a JSON server in our system and alongside we'll try to create a REST API.

Is JSON server a REST API?

JSON Server is a simple project that helps you to setup a REST API with CRUD operations very fast. The project website can be found at https://github.com/typicode/json-server. In the following you'll lean how to setup JSON server and publish a sample REST API.


1 Answers

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.

like image 133
kpollock Avatar answered Dec 31 '22 01:12

kpollock