Install JSON Server
- βοΈAdd json-serverInstall and configure json-server as a fake REST API server.
What is json-server?
json-server is a small package that helps you to create a REST API with zero coding in less than 30 seconds. Itβs a full fake REST API with zero coding that allows you to create, read, update and delete tasks.
It wonβt provide us a real API server, but itβs a great tool to focus on the Angular part of the application.
Letβs install it and create a fake database.
π Instructions
-
Run the following command in a terminal to Install json-server.
-
Create a
db.json
file at the project root and populate it with a list of tasks. -
Create a
start-server
script in yourpackage.json
file. -
Run the following command to start json-server.
-
Open your browser and go to
http://localhost:3000/tasks
.
βοΈ What you learned
In this chapter, you learned how to add json-server and configure it to create a fake REST API server. Itβll be use in next chapters to create, read, update and delete tasks as if you were interacting with a real API server.