@middy-add-ons/api-gateway-body-decoder
v2.0.1
Published
Middy wrapper to provide a handler as a service
Downloads
4
Maintainers
Readme
API Gateway Body Decoder
Middleware to decode (unserialize) application event from AWS events using io-ts.
Install
npm install @middy-add-ons/api-gateway-body-decoder
Usage
import middy from '@middy/core'
import { apiGatewayBodyDecoder } from '@middy-add-ons/api-gateway-body-decoder'
const Body = t.readonly(
t.type({
foo: t.string,
functionName: t.string,
}),
)
type Body = t.TypeOf<typeof Body>
middy(...)
.use(apiGatewayBodyDecoder(Body));