我的应用程序在本地运行,但是当我将它部署到 Heroku 上时,它返回内部服务器错误,以下是我的设置
const app = express();
app.use(bodyParser.urlencoded({extended: false}));
app.use(express.static(__dirname + "/public/"));
const path = require("path");
app.get("/", (req, res, next) => {
// res.sendFile(path.join(__dirname, + "public", 'index.html'));
res.sendFile(__dirname + "/public/index.html");
//res.send('Testing one two');
});
简介:
"web: npm run dev"
当我将 res.sendfile 更改为 res.send('hello') 时,这有效
所以我使用 npm run dev 来运行应用程序,除非部署在 heroku 上,否则一切正常,我想我做错了什么,但我已经尽力了,我不会工作。任何帮助请