Created
August 13, 2023 04:11
-
-
Save ColeMurray/0a26133152bdb098ad25730f731a9ef1 to your computer and use it in GitHub Desktop.
source/lambdaServer.ts for starting serverless express
This file contains 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 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