Install
npm install middy-aws-cookie-parser --save
Usage
import type { APIGatewayEventWithCookie } from 'middy-cookie-parser'
import middy from '@middy/core'
import CookieParser from 'middy-aws-cookie-parser'
async function baseHandler(event: Partial<APIGatewayEventWithCookie>) {
// event.cookies is available as a parsed cookie jar
return {
statusCode: 200,
body: JSON.stringify(
event.cookies
)
}
}
const handler = middy(baseHandler)
.use(CookieParser())