简体   繁体   English

如何从快速服务器运行反应应用程序?

[英]How to Run react app from express server?

How to run the react page index.html from express server 3000 port?I am new to react...so really need help in this.如何从快速服务器 3000 端口运行反应页面 index.html?我是反应的新手......所以真的需要帮助。 Please find the screenshot of my server.js page.请找到我的 server.js 页面的屏幕截图。 在此处输入图片说明

Thanks.谢谢。

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.

相关问题 如何将配置变量从服务器(Express)传递到React App - How to pass config variables from server (Express) to React App 如何在生产模式下使用React运行Express应用 - How to run Express app with React in production mode 我可以在不运行“npm run build”的情况下从快速服务器提供 create react 应用程序吗? - Can I serve a create react app from an express server without running 'npm run build'? Express 服务器与 React App 通信 - Express server communicating with React App 如何在快速服务器的每个 React 页面上运行中间件 - How to run middleware on each React page in express server 如何将Express和React应用程序堆叠在一起,然后在Docker中运行 - how do I stack express and react app together and then run it in docker 如何在React-Express Node App中将对象从服务器发送到客户端组件 - How to send objects from server to client side components in react-express node app 如何从后端快速服务器获取数据到前端反应应用程序,反之亦然 - How to get data from backend express server to frontend react app and vice versa 如何在 Oauth 应用程序中将访问令牌从快速服务器传递到反应应用程序? - How do I pass access tokens from express server to react app, in a Oauth application? 从反应应用程序向快递服务器发送请求时如何修复CORS错误 - How to fix CORS error when sending a request to express server from react app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM