Used by Airporting
NodeJs 18.x or newer only.
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());
export default async ({ body }) => {
// direct usage of body as an object
};
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.