This project is a very rudimentary calculator API, deployed on AWS, using the AWS CDK to describe the infrastructure.
aws-kms.Key
: For encrypting environment variables inside a Lambda functionaws-lambda.NodejsFunction
: A specialized version of Lambda.Function that automatically handles transpilation from TypeScript to JavaScriptaws-apigateway.RequestValidator
: A validator to ensure correctness of query parametersaws-apigateway.RestApi
: The umbrella API Gateway instance that routes requests to the correct handleraws-apigateway.LambdaIntegration
: A construct to connect an API Gateway resource to a particular Lambda function
The API is expressed as 4 GET endpoints, one for each arithmetic operation. Each endpoint requires 2 query parameters, value1
and value2
. For the multiplication, division, and subtraction endpoints, value1 will come first in the "equation" (ie. value1 / value2
).
- Addition:
GET /add?value1=4&value2=5
- Subtraction:
GET /subtract?value1=4&value2=5
- Multiplication:
GET /multiply?value1=4&value2=5
- Division:
GET /divide?value1=4&value2=5
- Route53 custom domain creation and associated ACM cert.
- Refactoring of the lambda and endpoint method creation logic. Creating a factory method for each would cut down a lot of boilerplate in the stack definition.