23 lines
727 B
TypeScript
23 lines
727 B
TypeScript
import { Construct } from 'constructs';
|
|
import * as nodejs from 'aws-cdk-lib/aws-lambda-nodejs';
|
|
import * as lambda from 'aws-cdk-lib/aws-lambda';
|
|
import * as apigateway from 'aws-cdk-lib/aws-apigateway';
|
|
|
|
export class ContactConstruct extends Construct {
|
|
constructor(scope: Construct, id: string) {
|
|
super(scope, id);
|
|
|
|
const contactLambda = new nodejs.NodejsFunction(this, 'contact', {
|
|
runtime: lambda.Runtime.NODEJS_24_X
|
|
});
|
|
|
|
const api = new apigateway.LambdaRestApi(this, 'ContactApi', {
|
|
handler: contactLambda,
|
|
proxy: false
|
|
});
|
|
|
|
const contactResource = api.root.addResource('contact');
|
|
contactResource.addMethod('GET');
|
|
}
|
|
}
|