【发布时间】:2019-12-27 20:50:04
【问题描述】:
我正在尝试在开发模式下设置 react 和 spring boot。我运行前端和后端单独的端口,即; http://localhost:3000/api/hello 和 http://localhost:8080/api/hello 分别。我喜欢在后端调用服务并在前端显示结果,为此我在 react app package.json 文件中添加了“proxy”:“http://localhost:8080”。但它不起作用。
请帮我解决一下?
package.json 文件
{
"name": "frontend",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.3.1",
"react-dom": "^16.3.1",
"react-scripts": "1.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"proxy": "http://localhost:8080",
}
我可以使用前端 reactjs 代码显示后端 spring boot 代码
【问题讨论】:
标签: reactjs spring-boot