Last active
February 22, 2021 15:14
-
-
Save apoorvmote/452d16af51682f41f044624ff3dd9c3d to your computer and use it in GitHub Desktop.
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 { APIGatewayProxyEventV2, APIGatewayProxyResultV2 } from 'aws-lambda' | |
export async function myFunction(event: APIGatewayProxyEventV2): Promise<APIGatewayProxyResultV2> { | |
return { | |
statusCode: 200, | |
body: JSON.stringify({ message: 'hello from ts lambda' }) | |
} | |
} |
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 { Runtime } from '@aws-cdk/aws-lambda'; | |
import { NodejsFunction } from '@aws-cdk/aws-lambda-nodejs'; | |
import * as cdk from '@aws-cdk/core'; | |
export class TsLambdaStack extends cdk.Stack { | |
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) { | |
super(scope, id, props); | |
// The code that defines your stack goes here | |
new NodejsFunction(this, 'helloWorldFn', { | |
runtime: Runtime.NODEJS_14_X, | |
entry: `${__dirname}/../lambda-fns/hello-world/index.ts`, | |
handler: 'myFunction', | |
memorySize: 128, | |
bundling: { | |
minify: true, | |
tsconfig: `${__dirname}/../lambda-fns/hello-world/tsconfig.json` // optional if you want to override defaults | |
} | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment