Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/airporting/middy-json-body-parser
HTTP json body parser middleware for the middy framework, fault tolerant
https://github.com/airporting/middy-json-body-parser
middy
Last synced: 3 months ago
JSON representation
HTTP json body parser middleware for the middy framework, fault tolerant
- Host: GitHub
- URL: https://github.com/airporting/middy-json-body-parser
- Owner: airporting
- License: mit
- Created: 2023-12-01T09:36:15.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-08-04T00:18:22.000Z (3 months ago)
- Last Synced: 2024-08-04T02:28:47.233Z (3 months ago)
- Topics: middy
- Language: JavaScript
- Homepage:
- Size: 3.84 MB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
![Static Badge](https://img.shields.io/badge/coverage-100-brightgreen)
![Static Badge](https://img.shields.io/badge/release-1.0.8-blue)
[![test](https://github.com/airporting/middy-json-body-parser/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/airporting/middy-json-body-parser/actions/workflows/test.yml)Used by [Airporting](https://www.airporting.com)
NodeJs 18.x or newer only.
[![Linkedin](https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/company/airporting)
# middy-json-body-parser
Automatically parses HTTP requests with a JSON body and converts the body into an object.
```javascript
import middy from '@middy/core';
import httpJsonBodyParserMiddleware from '@airporting/middy-json-body-parser';middy(yourHandler).use(httpJsonBodyParserMiddleware());
```## Usage
```javascript
export default async ({ body }) => {
// direct usage of body as an object
};
```## What about the official one ?
Middy organisation provides this
package: [@middy/http-json-body-parser](https://middy.js.org/docs/middlewares/http-json-body-parser)It's a great package. Working well.
But. It's not really fault tolerant. You need to validate data passed to it in front of this middleware. We believe, at
Airporting that the execution order should be the reversed. That's all folks.