Heroku 无法获取/

Heroku Cannot GET/

我用 Heroku 部署了我的项目,一切正常,但是当我刷新页面时,我收到错误“无法获取 /home”。有没有人可以帮助我? https://fresh-bio.herokuapp.com/

server.js:

require("dotenv").config();
const express = require("express");
const cors = require("cors");
const app = express();
const connectDB = require("./config/connectDB");
const routesProducts = require("./routes/productsRoutes");
const routesUsers = require("./routes/userRoutes");

app.use(express.json());
app.use(cors());
connectDB();
app.use("/api/products", routesProducts);
app.use("/api/users", routesUsers);
app.use(express.static("client/build"));

app.get("/", function (req, res) {
  res.sendFile("client/build/index.html");
});
if (process.env.NODE_ENV === "production") {
  app.use(express.static("client/build"));
}

const PORT = process.env.PORT || 5000;
app.listen(process.env.PORT, (err) =>
  err
    ? console.error(err.message)
    : console.log(`This server is running on localhost:${process.env.PORT}...`)
);
require("dotenv").config();
const express = require("express");
const cors = require("cors");
const app = express();
const connectDB = require("./config/connectDB");
const routesProducts = require("./routes/productsRoutes");
const routesUsers = require("./routes/userRoutes");

app.use(express.json());
app.use(cors());
connectDB();
app.use("/api/products", routesProducts);
app.use("/api/users", routesUsers);
app.use(express.static(__dirname + "/client/build/"));
app.get(/.*/, (req, res) => {
  res.sendFile(__dirname + "/client/build/index.html");
});


const PORT = process.env.PORT || 5000;
app.listen(process.env.PORT, (err) =>
  err
    ? console.error(err.message)
    : console.log(`This server is running on localhost:${process.env.PORT}...`)
);