简体   繁体   中英

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. 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.

Try to add that folder and then it will work fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM