I pushed in production my first MERN project.
The problem is, on reload i get a cannot GET /profile
for example.
I read that it du to react-router-dom.
So here is my code that should handle this, but I can't succeed :
if (process.env.NODE_ENV === 'production') {
app.use(express.static('client/build'))
app.get('*', (req, res) => {
res.sendFile(path.resolve(__dirname, 'client', 'build', 'index.html'))
})
}
I know the first line works fine, but the second makes everything crash.
Any idea ?
For those who need, I just forgot the ```const path = require('path').