我正在为我的节点服务器编写一些代码,并且本地一切正常。但是,当我部署它,我得到臭名昭着的“无法GET /”404错误。我写的所有其他路线都已成功(本地和云端)。节点快递服务器无法获取“/”
我已经包含下面的代码。我检查了我的环境变量,并将它们全部对齐。如果你们有任何关于这个原因的理论,我们将非常感激。
//Use this route to make the entire app secure. This forces login for any path in the entire app.
app.use('/', passport.authenticate('main', {
noredirect: false //Don't redirect a user to the authentication page, just show an error
}),
express.static(path.join(__dirname, '../public'))
);