https://github.com/abdurrahmanekr/json-body-trim
https://github.com/abdurrahmanekr/json-body-trim
express express-middleware json-trim trim
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/abdurrahmanekr/json-body-trim
- Owner: abdurrahmanekr
- Created: 2018-11-01T19:35:52.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-11-01T19:35:59.000Z (almost 8 years ago)
- Last Synced: 2025-04-10T22:37:42.093Z (over 1 year ago)
- Topics: express, express-middleware, json-trim, trim
- Language: JavaScript
- Size: 1000 Bytes
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# JSON Body Trim
Json white space cleaner
## Install
```bash
$ npm i json-body-trim --save
```
## API
```javascript
const jsonBodyTrim = require('json-body-trim');
const app = require('express')();
app.use(jsonBodyTrim());
...
```
# Example
```javascript
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"}
```