This Lamware Middleware utilizes the lambda-warmer
package, automating usage of it by providing:
- Automatically registering the warming listener
- Early-exit out of your Function if it detects a warming event
Installation
This package is available via NPM:
yarn add @lamware/warmer
# or
npm install @lamware/warmer
Usage
import type { APIGatewayProxyHandlerV2 } from 'aws-lambda';
import { warmer } from '@lamware/warmer';
import { lamware } from '@lamware/core';
const { handler } = lamware<APIGatewayProxyHandlerV2<any>>()
.use(warmer())
.execute(async () => {
return { statusCode: 200 };
});
export { handler };