Create an Amazon API Gateway to AWS Lambda REST API
This pattern in CDK offers a boilerplate to generate an Amazon API Gateway REST API endpoint with a a greedy proxy ('{proxy+}') and 'ANY' method from the specified path, meaning it will accept by default any method and any path. The Lambda function provided in TypeScript only returns the path.
After deployment, the output shows the API Gateway URL with the Lambda Integration, for example: ServerlessLandApi.ServerlessLandEndpointC36EEEC4 = https://.execute-api.us-east-1.amazonaws.com/prod/.
Accessing the URL in a browser, you see:
Hello, your path is: "/".
This page logs any path you type after "/". You can use this as a starting point as a general purpose endpoint for various types of applications.
Cleanup
1. Delete the stack: npm run destroy
2. Confirm the removal and wait for the resource deletion to complete.