【发布时间】:2021-07-13 20:29:00
【问题描述】:
我正在使用快速服务器为反应应用程序提供服务。我使用代理为 api 请求设置反应应用程序。现在我正在使用 Nodejs 为反应构建提供 404 错误。 API 路由不再有效。
"proxy": "http://localhost:5000/api/v1"
app.use(express.static('frontend/build'))
const path = require('path')
app.get('*', (req, res) => {
res.sendFile(path.resolve(__dirname, 'frontend', 'build', 'index.html'))
})
【问题讨论】: