diff --git a/backend/backend_stack.py b/backend/backend_stack.py index 0f9d5d5..7b62091 100644 --- a/backend/backend_stack.py +++ b/backend/backend_stack.py @@ -1,4 +1,4 @@ -from aws_cdk import Stack, aws_lambda +from aws_cdk import Stack, aws_lambda, aws_apigateway from constructs import Construct @@ -6,10 +6,21 @@ class BackendStack(Stack): def __init__(self, scope: Construct, id: str, **kwargs): super().__init__(scope, id, **kwargs) - aws_lambda.Function( + backend_lambda = aws_lambda.Function( scope=self, id="ChatbotBackendLambda", runtime=aws_lambda.Runtime.PYTHON_3_11, handler="backend_lambda.handler", code=aws_lambda.Code.from_asset("backend/lambda"), ) + + backend_apigw = aws_apigateway.LambdaRestApi( + scope=self, + id="ChatbotBackendAPI", + handler=backend_lambda, + ) + + chatbot_res = backend_apigw.root.add_resource("chatbot") + + chatbot_res.add_method("GET") + chatbot_res.add_method("POST")