March 2018
Beginner to intermediate
344 pages
7h 7m
English
In order to create a mock API, we can use the json-server library. This allows us to get up-and-running globally quickly by just creating a db.json file inside of our project. It effectively creates a GET, POST, PUT, PATCH, and DELETE API and stores the data in a file, appended to our original JSON file.
We can install it by running the following in our Terminal:
# Install the json-server module globally$ npm install json-server -g
As we've added the -g flag, we'll be able to access the json-server module globally throughout our Terminal.
The next thing we need to do is create our db.json file inside the root of our project. Be as creative as you want with your dataset; we just simply have a list of courses that we ...
Read now
Unlock full access