I have found the solution to error from here
app.get('/*', function(req, res) {
res.sendFile(path.join(__dirname, 'path/to/your/index.html'), function(err) {
if (err) {
res.status(500).send(err)
}
})
})
but I am not able to understand what I have actually write in that index.html file
This solved my problem all thanks to @Mosh Feu Who helped me a lot in this problem solving you can see discussion in this chat
NOTE : use index.html file after declaring routes to api
app.use("/api", indexRouter);
app.get('/*', function (req, res) {
res.sendFile(path.join(__dirname, '/build/index.html'), function (err) {
if (err) {
res.status(500).send(err)
}
})
})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With