diff --git a/.github/ci-test.txt b/.github/ci-test.txt new file mode 100644 index 0000000..28c218c --- /dev/null +++ b/.github/ci-test.txt @@ -0,0 +1 @@ +v1 \ No newline at end of file diff --git a/packages/functions/src/sample-python-lambda/lambda.py b/packages/functions/src/sample-python-lambda/lambda.py new file mode 100644 index 0000000..d787cba --- /dev/null +++ b/packages/functions/src/sample-python-lambda/lambda.py @@ -0,0 +1,3 @@ + +def main(event, context): + return "Hello from Lambda" \ No newline at end of file diff --git a/packages/functions/src/sample-python-lambda/requirements.txt b/packages/functions/src/sample-python-lambda/requirements.txt new file mode 100644 index 0000000..e69de29 diff --git a/stacks/ApiStack.ts b/stacks/ApiStack.ts index b9f90b2..07a6d15 100644 --- a/stacks/ApiStack.ts +++ b/stacks/ApiStack.ts @@ -6,18 +6,27 @@ import { Duration } from "aws-cdk-lib/core"; export function ApiStack({ stack }: StackContext) { const {table} = use(DBStack); - + // Create the HTTP API const api = new Api(stack, "Api", { defaults: { - function: { - // Bind the table name to our API - bind: [table], - }, + function: { + // Bind the table name to our API + bind: [table], + }, }, routes: { - "POST /": "packages/functions/src/lambda.main", - }, + // Sample TypeScript lambda function + "POST /": "packages/functions/src/lambda.main", + // Sample Pyhton lambda function + "GET /": { + function: { + handler: "packages/functions/src/sample-python-lambda/lambda.main", + runtime: "python3.11", + timeout: "60 seconds", + } + }, + } }); // cache policy to use with cloudfront as reverse proxy to avoid cors diff --git a/stacks/FrontendStack.ts b/stacks/FrontendStack.ts index d55def9..5faaeb1 100644 --- a/stacks/FrontendStack.ts +++ b/stacks/FrontendStack.ts @@ -41,7 +41,7 @@ export function FrontendStack({ stack }: StackContext) { }, } }); - + // Show the URLs in the output stack.addOutputs({ SiteUrl: site.url,