[英]Express Node.js react integration( Refused to apply style and failed to load resource)
first of all, i integrated an skeleton of a react app with express node js, and it works good.首先,我用 express node js 集成了一个 react 应用的骨架,效果很好。 But when i try with an existing app i'm getting from server:但是当我尝试使用现有应用程序时,我从服务器获取:
The code of the small server is:小服务器的代码是:
const express = require("express");
const bodyParser = require("body-parser");
const path = require("path");
const app = express();
app.use(express.static(path.join(__dirname, "build")));
app.get("/ping", function(req, res) {
return res.send("pong");
});
app.get("/", function(req, res) {
res.sendFile(path.join(__dirname, "build", "index.html"));
});
app.listen(process.env.PORT || 8080);
It seems like you don't have the folder agora-ux
inside your build
folder, which is why it's giving a 404 Not Found error.您的build
文件夹中似乎没有agora-ux
文件夹,这就是它给出 404 Not Found 错误的原因。
Try to add that folder and then it will work fine.尝试添加该文件夹,然后它会正常工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.