当我重新加载 Heroku 页面时,出现内部服务器错误,状态代码为 500。
但在我的本地环境中并没有发生这种情况。
最重要的是,
当我访问正确重定向并正常显示的路由地址时。
当我重新加载页面时,在 chrom dev 工具的网络信息中表示该页面没有处理任何进程。
我的程序有什么问题?这是网站。
https://boiling-falls-61617.herokuapp.com/
这是我的错误和代码。
错误
2020-03-15T19:33:53.875586+00:00 heroku[router]: at=info method=GET path="/dashboards/5e6b999eb7f157252c8c6937" host=boiling-falls-61617.herokuapp.com request_id=785b2a93-2739-455f-856e-e59fb5af18ce fwd="99.251.226.61" dyno=web.1 connect=0ms service=2ms status=500 bytes=404 protocol=https
Run Code Online (Sandbox Code Playgroud)
服务器代码
if (process.env.NODE_ENV === "production") {
app.use(express.static(path.join(__dirname, "client", "build")));
app.get("*", (req, res) => {
// don't serve api routes to react app
res.sendFile(path.join(__dirname, "./client/build/index.html"));
});
console.log("Serving React App...");
}
Run Code Online (Sandbox Code Playgroud)
前端
function App() {
return (
<MuiThemeProvider theme={theme}>
<BrowserRouter>
<PrivateRoute path='/dashboards/:dashboardId' component={DashBoard} />
<Route exact path='/' component={SignIn} />
<Route path='/signup' component={SignUp} /> …Run Code Online (Sandbox Code Playgroud)