Skip to content

HTTP json body parser middleware for the middy framework, fault tolerant

License

Notifications You must be signed in to change notification settings

airporting/middy-json-body-parser

Repository files navigation

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.

About

HTTP json body parser middleware for the middy framework, fault tolerant

Topics

Resources

License

Stars

Watchers

Forks