1. Install json-server globally (no matter which directory it is at this time)
2. cd to the location of the current project folder and create a new folder jsonserver
3. Run npm init in the current directory
4. Install and run npm install json-server --save again
5. The directory structure at this time
--jsonserver
--node_moduies
--package-lock.json
--package.json
6. Open the package.json file and change the content here to: json-server --watch Customize a json file
7. Create a new db.json under the folder
8. Write the content in db.json
9. After saving, enter npm run json:server on the command line
10. At this time, enter localhost:3000 in the browser to get the data of json:server
You can also execute json-server data.json directly in the terminal