📌  相关文章
📜  axios 响应返回 html 而不是 json 数据 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:19.979000             🧑  作者: Mango

代码示例1
// use this after route not before route
if (process.env.NODE_ENV === 'production') {
  app.use(express.static(resolve(process.cwd(), 'client/build')))
  app.get('*', (req, res) => {
    res.sendFile(resolve(process.cwd(), 'client/build/index.html'))
  })
}