heroku get requests return html code in production

Solutions on MaxInterview for heroku get requests return html code in production by the best coders in the world

showing results for - "heroku get requests return html code in production"
Salomé
12 Aug 2019
1// use this after route not before route
2if (process.env.NODE_ENV === 'production') {
3  app.use(express.static(resolve(process.cwd(), 'client/build')))
4  app.get('*', (req, res) => {
5    res.sendFile(resolve(process.cwd(), 'client/build/index.html'))
6  })
7}
similar questions