Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/abdurrahmanekr/json-body-trim
https://github.com/abdurrahmanekr/json-body-trim
express express-middleware json-trim trim
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/abdurrahmanekr/json-body-trim
- Owner: abdurrahmanekr
- Created: 2018-11-01T19:35:52.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-11-01T19:35:59.000Z (about 6 years ago)
- Last Synced: 2024-10-11T20:02:04.750Z (about 1 month ago)
- Topics: express, express-middleware, json-trim, trim
- Language: JavaScript
- Size: 1000 Bytes
- Stars: 7
- Watchers: 3
- 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"}
```