package.json scripts内添加 "serve": "json-server src/_db.json --port 3004"
src/_db.json
表示数据文件的路径
启动项目 npm run serve
JSON Server started on PORT :3004
Press CTRL-C to stop
Watching src/_db.json...
♡⸜(˶˃ ᵕ ˂˶)⸝♡
Index:
http://localhost:3004/
Static files:
Serving ./public directory if it exists
Endpoints:
http://localhost:3004/list
出现这个表示成功