Install JSON Server
- ✔️Add json-serverInstall and configure json-server as a fake API server.
What is json-server?
json-server is a small package that helps you to create an API with zero coding in less than 30 seconds. It’s a full fake 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 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.