[英]json-server homepage is not showing
I created a react-app with npx create-react-app in package.json added json-server and run script.我在 package.json 中使用 npx create-react-app 创建了一个 react-app 添加了 json-server 并运行脚本。
"devDependencies": {
"json-server": "0.14.2",
"react-scripts": "1.0.10",
"styled-components": "^2.1.1"
},
"scripts": {
"apiserver": "json-server -p 3001 -w tools/db.json",
When I start the json-server with npm run apiserver
it starts successfully.当我使用npm run apiserver
启动 json-server 时,它会成功启动。 But home page does not load.但是主页没有加载。
\{^_^}/ hi!
Loading tools/db.json
Done
Resources
http://localhost:3001/posts
Home
http://localhost:3001
Type s + enter at any time to create a snapshot of the database
Watching...
Not loading :(没有加载:(
Also I have json-server installed globally.我还全局安装了 json-server。 So when I start it like that:所以当我这样开始时:
json-server -w db.json -p 3001 json-server -w db.json -p 3001
It loads successfully:它加载成功:
I created a react-app with npx create-react-app in package.json added json-server and run script.我在package.json中创建了一个带有npx create-react-app的react-app,并添加了json-server并运行脚本。
"devDependencies": {
"json-server": "0.14.2",
"react-scripts": "1.0.10",
"styled-components": "^2.1.1"
},
"scripts": {
"apiserver": "json-server -p 3001 -w tools/db.json",
When I start the json-server with npm run apiserver
it starts successfully.当我使用npm run apiserver
启动json-server时,它将成功启动。 But home page does not load.但是不会加载主页。
\{^_^}/ hi!
Loading tools/db.json
Done
Resources
http://localhost:3001/posts
Home
http://localhost:3001
Type s + enter at any time to create a snapshot of the database
Watching...
Not loading :(未加载:(
Also I have json-server installed globally.另外,我在全球范围内安装了json-server。 So when I start it like that:因此,当我像这样启动它时:
json-server -w db.json -p 3001 json服务器-w db.json -p 3001
It loads successfully:它加载成功:
I created a react-app with npx create-react-app in package.json added json-server and run script.我在package.json中创建了一个带有npx create-react-app的react-app,并添加了json-server并运行脚本。
"devDependencies": {
"json-server": "0.14.2",
"react-scripts": "1.0.10",
"styled-components": "^2.1.1"
},
"scripts": {
"apiserver": "json-server -p 3001 -w tools/db.json",
When I start the json-server with npm run apiserver
it starts successfully.当我使用npm run apiserver
启动json-server时,它将成功启动。 But home page does not load.但是不会加载主页。
\{^_^}/ hi!
Loading tools/db.json
Done
Resources
http://localhost:3001/posts
Home
http://localhost:3001
Type s + enter at any time to create a snapshot of the database
Watching...
Not loading :(未加载:(
Also I have json-server installed globally.另外,我在全球范围内安装了json-server。 So when I start it like that:因此,当我像这样启动它时:
json-server -w db.json -p 3001 json服务器-w db.json -p 3001
It loads successfully:它加载成功:
在用于启动 json-server 的同一命令行窗口中,如果按 s 然后输入,它将在与原始文件相同的目录中保存一个新文件
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.