Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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()
  }
})
Source by github.com #
 
PREVIOUS NEXT
Tagged: #log #bodyparser #error
ADD COMMENT
Topic
Name
5+3 =