首页 > 解决方案 > Heroku 说构建成功,但前端没有出现

问题描述

Heroku 说我的应用程序已经构建成功,但是当我进入部署的网站时,我只能看到:

“在路径中访问 API”

我已按照 Heroku 上的详细说明进行操作,这就是我在 app.js 文件中的内容(与我已经部署好的另一个应用程序的格式完全相同):

app.use(express.static(path.join(__dirname, "client/build")));
app.get("/", function (req, res, next) {
  res.send("Access the API at path /api");
});

app.use("/bubbles", bubblesRouter);

// Anything that doesn't match the above, send back index.html
app.get("*", (req, res) => {
  res.sendFile(path.join(__dirname + "/client/build/index.html"));
});

有谁知道为什么我打开应用程序时看不到前端?

标签: reactjsherokudeployment

解决方案


推荐阅读