Previously, we had a full node server for the backend, but this time we will not focus on the app features. So, we will use the json-server package to generate a very simple local API for the purpose of this chapter:
- Install json-server as a dev dependency:
npm i -D json-server
- When we run this package, it will locally expose a simple REST API and use a db.json file to store the data. You can download it (https://github.com/Akryum/packt-vue-project-guide/blob/master/chapter7-download/db.json) and put it in the project root directory. If you open it, you will see a few items for sale and a comment.
- Then, we will need to add a script to launch the json server. Add a new db script to the package.json ...