express-payload-sanitizer
v1.0.1
Published
Express Payload Sanitizer is a middleware package for Express.js that provides two essential utilities: - **`cleanPayload`**: Cleans `req.body` by removing empty strings, `null` values, and empty objects. - **`restrictRequest`**: Validates `req.body` to e
Downloads
56
Maintainers
Readme
Express Payload Sanitizer
Express Payload Sanitizer is a middleware package for Express.js that provides two essential utilities:
cleanPayload
: Cleansreq.body
by removing empty strings,null
values, and empty objects.restrictRequest
: Validatesreq.body
to ensure nonull
,undefined
, or invalidNaN
values are present and return bad request as response to client side.
Features
- Lightweight: Easy to integrate into any Express.js project.
- Recursive Cleaning: Handles nested objects and arrays.
- Validation: Enforces strict payload standards for your API.
Installation
Install the package via NPM:
npm install express-payload-sanitizer