bodyparser-json-error
Beautify body parser JSON syntax error
Installation
npm install bodyparser-json-error --save
Usage
var express = ;var bodyParser = ;var bodyParserError = ; var app = ; app;app; // Beautify body parser json syntax errorapp;
Middleware Options
You can optionally set the status code and response for the body parser syntax error.
app;
The output:
HTTP Status Code: 500
"msg": "You sent a bad JSON !"
Options
- status: The response status code. Default: 400
- res: The response body. Default:
{msg: 'Invalid JSON'}
Tests
To run the test suite, first install the dependencies, then run npm test
:
$ npm install$ npm test
License
MIT License