![](/img/trans.png)
[英]Make a multi-page app with create-react-app and express.js
[英]Deploy React-(Create-React-App),Express.js and MySQL
如何部署React(Create-React-App),Express.js和MySQL?
我尝试在cPanel上进行部署。 我必须将其更改为生产模式吗? 如何在Express.js上访问API? 我必须在Express.js上创建一个子域吗?
因为到目前为止,我只使用并发和nodemon的库。 在React.js上,我添加了一个像这样的代理:“ proxy”:“ http:// localhost:5000”,其中localhost:5000具有Express.js的端口
server.js中的Package.json脚本
"scripts": {
"client-install": "npm install --prefix client",
"start": "node server.js",
"server": "nodemon server.js",
"client": "npm start --prefix client",
"dev": "concurrently --kill-others \" npm run server\" \"npm run client\""
},
React中的Package.json脚本
"proxy": "http://localhost:5000",
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
我的应用程式:
您在cPanel上有终端访问权限吗? 如果是的话
nginx
或Apache webserver
),则将服务器文件配置为在*:80
和*:443
上重定向到localhost:5050
5050
上投放 就是这样。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.