It looks like error is not fixed, I got an error while fetching data
Unexpected token < at json at 0```
It looks like error is not fixed, I got an error while fetching data
Unexpected token < at json at 0```
Let me guess, you were trying to do a POST request and trying to send some data back to the client? This usually happens when you don’t use the body-parser package.
That’s true I am sending post request ,but I used body-parser
How are you initiating body-parser with your app?
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({
extended:true
}))
parse it, worked with mine
Can you show us the bit of code that is giving the error when it cannot parse the json!