Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Latest commit

 

History

History
39 lines (26 loc) · 1.46 KB

README.md

File metadata and controls

39 lines (26 loc) · 1.46 KB

License: MIT Static Badge Static Badge test

Used by Airporting

NodeJs 18.x or newer only.

Linkedin

middy-json-body-parser

Automatically parses HTTP requests with a JSON body and converts the body into an object.

import middy from '@middy/core';
import httpJsonBodyParserMiddleware from '@airporting/middy-json-body-parser';

middy(yourHandler).use(httpJsonBodyParserMiddleware());

Usage

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

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.