Skip to content

Instantly share code, notes, and snippets.

@ColeMurray
Created August 13, 2023 04:11
Show Gist options
  • Save ColeMurray/0a26133152bdb098ad25730f731a9ef1 to your computer and use it in GitHub Desktop.
Save ColeMurray/0a26133152bdb098ad25730f731a9ef1 to your computer and use it in GitHub Desktop.
source/lambdaServer.ts for starting serverless express
import serverlessExpress from '@vendia/serverless-express';
import {app} from './app';
let serverlessExpressInstance: any;
async function setup (event: any, context: any) {
serverlessExpressInstance = serverlessExpress({ app })
return serverlessExpressInstance(event, context)
}
export function handler (event: any, context: any) {
if (serverlessExpressInstance) return serverlessExpressInstance(event, context)
return setup(event, context)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment