托管反应应用程序和快速服务器 cpanel [英] hosting react app and express server cpanel
本文介绍了托管反应应用程序和快速服务器 cpanel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是托管的新手,如果有人可以非常详细地解释,这将对我有很大帮助.
I am new to hosting and it would be of immense help to me if somebody can explain in very detail.
我有以下问题:
- 我有使用
react app
的前端和使用expressjs
和mysql
的后端.我的电脑中有一个简单的应用程序.我使用本地主机启动后端和前端,它们运行良好.当我购买支持nodejs
的主机时,我不知道将前端文件和后端文件放在哪里. npm run build
-> 构建一个 react 应用程序.在 cpanel 文件管理器中,我应该将哪个文件放在公共 html 中.前端代码或后端快速代码- 我将 html 代码放在 public_html 中,但如何开始与服务器交互.
- 当我使用 fetch("http://lcoalhost:30000") 获取时,我无法获取app.get("/",(req ,resp)) 正在工作 ..
- I have front end using
react app
and backend usingexpressjs
andmysql
. i have a working simple application in my computer . I start backend and front end using local host and they work perfect . when I bought hosting which supportsnodejs
, I don't know where to place the front end file and backend file . npm run build
- > builds a react app . in cpanel - file manager , which file I should place in public html . front end code or backend express code- I placed html code in public_html but how to start interacting with server.
- When I used fetch("http://lcoalhost:30000") to fetch I couldn't get the app.get("/",(req ,resp)) working ..
我真的很困惑.如果有人可以详细解释如何开始上传反应和快递文件以及放置这些文件的位置.
I am really confused . if somebody can explain in detail how to start uploading both the react and express file and the location to place these files.
推荐答案
- 在 public_html 中上传您的 React 应用构建文件.不要忘记将您的 express 应用的 localhost 网址更改为您的实际网址.
- 在 public_html 之外创建一个文件夹并在其中上传您的 Express 应用程序.
- 创建一个 nodejs 应用程序(使用 cPanel,如果有的话).在创建过程中使用 express 文件夹和不同于 home 的 url(如/api).
这篇关于托管反应应用程序和快速服务器 cpanel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文