Answers for "how to log bodyparser error"

0

how to log bodyparser error

app.use(bodyParser.json())

app.use((err, req, res, next) => {
  if (err) {
    console.log('Invalid Request data', err)
    res.status(400).send('Invalid Request data')
  } else {
    next()
  }
})
Posted by: Guest on November-09-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language