我使用 express 创建了一个 API,我想在我的前端服务器中使用它,问题是为了让我的 api 工作,我必须不断地在服务器上运行它。但是我不能同时运行我的反应应用程序。所以我的问题是如何同时启动我的反应服务器和 api?
PS 我同时尝试了,但我对如何让它工作感到困惑,这是我的 package.json 中的一些示例代码
{
"name": "app",
"version": "0.1.0",
"private": true,
"dependencies": {
"@material-ui/core": "^4.1.1",
"@material-ui/icons": "^4.2.0",
"axios": "^0.19.0",
"concurrently": "^4.1.0",
"express": "^4.17.1",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-scripts": "3.0.1"
},
"scripts": {
"start": "node src/connection",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"react": "react-scripts start",
"dev": "concurrently \"npm start\" \"npm react\""
},
"proxy": "http://localhost:3000",
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": []
}
}