[英]How to Run react app from express server?
It's not quite clear from the screenshot what is in public/index.html.从屏幕截图中不太清楚 public/index.html 中的内容。 Do you have any troubles with seeing index.html from http://localhost:3000?
从 http://localhost:3000 看到 index.html 有什么问题吗?
Anyway, you should configure your React application built in a way that it puts the output static files into the public folder and serve it from there with express.static
as you're currently doing.无论如何,您应该配置构建的 React 应用程序,将输出静态文件放入公共文件夹,并从那里使用
express.static
为它提供服务,就像您目前所做的那样。 If you're new to this, try generating your React application with create-react-app
and get the build process configured for you.如果您对此不熟悉,请尝试使用
create-react-app
生成您的 React 应用程序,并为您配置构建过程。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.