提问人:Moeez Ramay 提问时间:10/12/2023 更新时间:10/12/2023 访问量:23
从服务器加载资源时出错:服务器在 heroku 中以 404 响应
Error loading resource from server: the server responded with 404 in heroku
问:
这是我的服务器.js代码:
const jwt = require("jsonwebtoken");
const express = require("express");
const app = express();
const PORTS = process.env.PORT || 8080;
const cors = require("cors");
const router = express.Router();
router.get("/", (req, res) => {
res.send("Server is up!");
});
module.exports = router;
const sign = require("./apis/sign");
const upload = require("./apis/upload");
const KEY = "asfasfgasghhgewgwedsgawsdg";
app.use(cors());
app.use(express.json());
//Redirects to signIn or SignUp Api's
app.use("/sign", sign);
//Redirects to upload for data submitting on found page
app.use("/upload", upload);
app.listen(PORTS, () => {
console.log("Server started on port:", PORTS);
});
这些是我的 heroku 日志:
2023-10-12T15:52:43.964164+00:00 heroku[router]: at=info method=GET
path="/" host=pet-finder-1-6e4ec11ea0c6.herokuapp.com request_id=90a49113-fbf7-4b1b-bb18-ea7e00b81b35
fwd="119.155.0.144" dyno=web.1 connect=0ms service=6ms status=404 bytes=415 protocol=https
以下是一些额外的日志:
2023-10-12T15:52:47.983905+00:00 app[api]: Release v19 created by user [email protected]
2023-10-12T15:52:47.983905+00:00 app[api]: Deploy f4d731b6 by user [email protected]
2023-10-12T15:52:48.000000+00:00 app[api]: Build succeeded
2023-10-12T15:52:49.487848+00:00 heroku[web.1]: Restarting
2023-10-12T15:52:49.559516+00:00 heroku[web.1]: State changed from up to starting
2023-10-12T15:52:50.138712+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2023-10-12T15:52:50.296191+00:00 heroku[web.1]: Process exited with status 143
2023-10-12T15:52:51.902264+00:00 heroku[web.1]: Starting process with command `npm start`
我使用 nextjs 作为前端,使用 nodejs 作为后端,一切似乎都很好,但我不明白这个错误
答: 暂无答案
评论