【发布时间】:2021-11-29 08:51:13
【问题描述】:
我正在尝试使用 Google App Engine 托管我的项目,但无法显示我的页面。我的 package.json 看起来像这样
"name": "final",
"version": "1.0.0",
"description": "",
"main": "index.html",
"scripts": {
"start": "node app.js"
}
我的 app.js 看起来像这样:
const express = require('express');
const app = express();
app.get('/', (req, res) => {
res.sendFile('/index.html');
});
// Listen to the App Engine-specified port, or 8080 otherwise
const PORT = process.env.PORT || 8080;
app.listen(PORT, () => {
console.log(`Server listening on port ${PORT}...`);
});
当我部署时,页面只是显示 Not Found 并给我一个 404。我需要对我的 index.html 和它使用的后续 .js 文件做些什么,或者我在部署时是否上传了整个目录?错误日志除了 404 之外什么都没有。
【问题讨论】:
-
能否请您也添加
app.yaml文件?
标签: javascript node.js express google-app-engine