Saturday 8 April 2017

NextJS + ExpressJS Error with On Demand Entries Ping

I'm using NextJS and custom server with Express, But I got a problem when defining my routes in Express.

When I define Express routes like below it will throw an errors

app.get('/:username', handle.profile)
app.get('/:username/:id', (req, res) => {
  res.send('id')
})

But the errors just appears when I'm in Development mode. Which is when I go with Production the errors not shown.

Though errors in console, but all run normally, I just can't figure out why the error message coming. It's a weird.

Here's the errors message

Error with on-demand-entries-ping: Unexpected token i in JSON at position 0

Here's screenshot of the errors Express routes error

But when I define Express routes like below

app.get('/:username', handle.profile)
app.get('/:username/forum/:id', (req, res) => {
  res.send('id')
})

In Production or Development mode the errors is go on, my application going well.

Any solution please?



via Habib Rohman

No comments:

Post a Comment