学习reactjs,尝试用json-server模拟服务器
这是我运行服务器的脚本:
"scripts": {
"server": "json-server --watch db.json --port 5000"
},
Run Code Online (Sandbox Code Playgroud)
在终端输出上运行npm run server
:
Debugger listening on ws://127.0.0.1:61616/507f7893-92a9-4526-b8f4-a3e71cfa4c62
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
> my-app@0.1.0 server
> json-server --watch db.json --port 5000
Debugger listening on ws://127.0.0.1:61629/8a2f877f-f4bd-465e-b454-01a63eabb40a
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
\{^_^}/ hi!
Loading db.json
Done
Resources
http://localhost:5000/tasks
Home
http://localhost:5000
Type s + enter at any time to create a snapshot of the database
Watching...
Run Code Online (Sandbox Code Playgroud)
现在,当我尝试访问 http://localhost:5000/tasks 时,我收到 403 Access to localhost was returned 被拒绝。 …