-
-
Save imflamboyant/1cb88bb3491bee1d648b8bc86eb0ec27 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { configure as serverlessExpress } from '@vendia/serverless-express'; | |
| import { NestFactory } from '@nestjs/core'; | |
| import { AppModule } from './app.module'; | |
| let cachedServer; | |
| export const handler = async (event, context) => { | |
| if (!cachedServer) { | |
| const nestApp = await NestFactory.create(AppModule); | |
| await nestApp.init(); | |
| cachedServer = serverlessExpress({ app: nestApp.getHttpAdapter().getInstance() }); | |
| } | |
| return cachedServer(event, context); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment