json-body-trim

1.0.0 • Public • Published

JSON Body Trim

Json white space cleaner

Install

$ npm i json-body-trim --save

API

const jsonBodyTrim = require('json-body-trim');
const app = require('express')();
 
app.use(jsonBodyTrim());
 
...

Example

const jsonBodyTrim = require('json-body-trim');
const bodyParser = require('body-parser');
 
const app = require('express')();
 
app.use(bodyParser.json());
app.use(jsonBodyTrim());
 
app.post('/', (req, res) => {
    res.send(req.body);
})
 
app.listen(8080);
 
 
// post localhost:8080 this data: {"   test   ": "hello  "}
// response this data: {"test":"hello"}

Package Sidebar

Install

npm i json-body-trim

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

1.83 kB

Total Files

3

Last publish

Collaborators

  • abdurrahmanekr