Start the service to get the data in the json file

Install:

npm i json-server -g

Start the service:

 json-server .\db.json --watch

 --watch: means monitoring all the time

 Note: The current command occupies port 3000 by default

Sometimes when the port number 3000 is occupied, an error will be reported, so we can set the port number for him by ourselves

set port number

json-server .\db.json --watch --port=5000

--port=5000 is set to 5000 port number

 

 Effect:

Guess you like

Origin blog.csdn.net/qq_52421092/article/details/129823916