Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

task3.1: create lambda function for products list #13

Merged
merged 1 commit into from
Oct 17, 2022
Merged

task3.1: create lambda function for products list #13

merged 1 commit into from
Oct 17, 2022

Conversation

Guria
Copy link
Owner

@Guria Guria commented Oct 17, 2022

✔️ Create a lambda function called getProductsList of Product Service which will be triggered by the HTTP GET method.
✔️ The requested URL should be /products.
✔️ The response from the lambda should be a full array of products.
✔️ This endpoint should be integrated with Frontend app for Product List Page representation

Additional tasks:
✔️ Async/await is used in lambda functions
✔️ ES6 modules are used for Product Service implementation
✔️ ESBuild is configured for Product Service.

Extra effort:

  • api gateway is defined as separate service to reuse for all future lambdas
  • app is build on deploy stage with forked scriptable plugin
  • api gateway url is passed to frontend app build

✔️ Create a lambda function called `getProductsList` of Product Service which will be triggered by the HTTP GET method.
✔️ The requested URL should be `/products`.
✔️ The response from the lambda should be a full array of products.
✔️ This endpoint should be integrated with Frontend app for Product List Page representation

Additional tasks:
✔️ Async/await is used in lambda functions
✔️ ES6 modules are used for Product Service implementation
✔️ ESBuild is configured for Product Service.

Extra effort:
* api gateway is defined as separate service to reuse for all future lambdas
* app is build on deploy stage with forked scriptable plugin
* api gateway url is passed to frontend app build
@github-actions
Copy link

Build output

Deploying to stage task3-1
api-gw › waiting
products-api › waiting
shop-frontend-app › waiting
api-gw › deploying
api-gw › Running "serverless deploy --stage task3-1"
api-gw › Deploying aws-js-practitioner-api to stage task3-1 (us-east-1)
api-gw › ✔ Service deployed to stack aws-js-practitioner-api-task3-1 (59s)
api-gw › Running "serverless info --verbose --stage task3-1"
api-gw › service: aws-js-practitioner-api
api-gw › stage: task3-1
api-gw › region: us-east-1
api-gw › stack: aws-js-practitioner-api-task3-1
api-gw ›
api-gw › Stack Outputs:
api-gw › apiGatewayRestApiId: b0zo5s7x2k
api-gw › apiGatewayRestApiRootResourceId: 2mbogvk6mc
api-gw › ServerlessDeploymentBucketName: aws-js-practitioner-api-serverlessdeploymentbuck-1mdqn00z65htt
api-gw › deployed
products-api › deploying
products-api › Running "serverless deploy --stage task3-1 --param apiGatewayRestApiId=b0zo5s7x2k --param apiGatewayRestApiRootResourceId=2mbogvk6mc"
products-api › Deploying products-api to stage task3-1 (us-east-1)
products-api › ✔ Service deployed to stack products-api-task3-1 (120s)
products-api › endpoint: GET - https://b0zo5s7x2k.execute-api.us-east-1.amazonaws.com/task3-1/products
products-api › functions:
products-api › getProductsList: products-api-task3-1-getProductsList (139 kB)
products-api › Running "serverless info --verbose --stage task3-1 --param apiGatewayRestApiId=b0zo5s7x2k --param apiGatewayRestApiRootResourceId=2mbogvk6mc"
products-api › service: products-api
products-api › stage: task3-1
products-api › region: us-east-1
products-api › stack: products-api-task3-1
products-api › endpoint: GET - https://b0zo5s7x2k.execute-api.us-east-1.amazonaws.com/task3-1/products
products-api › functions:
products-api › getProductsList: products-api-task3-1-getProductsList
products-api › Stack Outputs:
products-api › GetProductsListLambdaFunctionQualifiedArn: arn:aws:lambda:us-east-1:609136581632:function:products-api-task3-1-getProductsList:2
products-api › ServiceEndpoint: https://b0zo5s7x2k.execute-api.us-east-1.amazonaws.com/task3-1
products-api › ServerlessDeploymentBucketName: products-api-task3-1-serverlessdeploymentbucket-jmc297im3wy5
products-api › deployed
shop-frontend-app › deploying
shop-frontend-app › Running "serverless deploy --stage task3-1 --param productsApiServiceEndpoint=https://b0zo5s7x2k.execute-api.us-east-1.amazonaws.com/task3-1"
shop-frontend-app › Deploying aws-js-practitioner-shop-frontend to stage task3-1 (us-east-1)
shop-frontend-app › Running command: echo "CONFIG = {BASE_URL: "https://b0zo5s7x2k.execute-api.us-east-1.amazonaws.com/task3-1\"}" > public/config.js
shop-frontend-app › npm run build
shop-frontend-app › > @guria.dev/[email protected] build
shop-frontend-app › > tsc && vite build
shop-frontend-app › vite v3.1.8 building for production...
shop-frontend-app › transforming...
shop-frontend-app › ✓ 1766 modules transformed.
shop-frontend-app › rendering chunks...
shop-frontend-app › dist/index.html 0.57 KiB
shop-frontend-app › dist/assets/dehydrated.eb01c8e5.js 0.58 KiB / gzip: 0.33 KiB
shop-frontend-app › dist/assets/libs.03b6e541.js 114.11 KiB / gzip: 37.69 KiB
shop-frontend-app › dist/assets/index.6b8a40ec.js 215.31 KiB / gzip: 65.42 KiB
shop-frontend-app › dist/assets/react.afe5f750.js 198.67 KiB / gzip: 60.67 KiB
shop-frontend-app › DistributionIdKey: WebAppDistributionIdOutput
shop-frontend-app › CloudfrontInvalidate: Invalidation started
shop-frontend-app › Web App deployed to Cloudfront and available at following addresses:
shop-frontend-app › * https://d2cb8a3kgzsr16.cloudfront.net
shop-frontend-app › * https://aws-js-practitioner-shop-frontend-task3-1.guria.dev
shop-frontend-app › ✔ Service deployed to stack aws-js-practitioner-shop-frontend-task3-1 (372s)
shop-frontend-app › Running "serverless info --verbose --stage task3-1 --param productsApiServiceEndpoint=https://b0zo5s7x2k.execute-api.us-east-1.amazonaws.com/task3-1"
shop-frontend-app › service: aws-js-practitioner-shop-frontend
shop-frontend-app › stage: task3-1
shop-frontend-app › region: us-east-1
shop-frontend-app › stack: aws-js-practitioner-shop-frontend-task3-1
shop-frontend-app › Stack Outputs:
shop-frontend-app › WebAppDistributionIdOutput: E1V9BEOIQ1FJ31
shop-frontend-app › WebAppDistributionOutput: d2cb8a3kgzsr16.cloudfront.net
shop-frontend-app › ServerlessDeploymentBucketName: aws-js-practitioner-shop-serverlessdeploymentbuck-qx9kk9g0dzo1
shop-frontend-app › WebAppCustomDomainOutput: aws-js-practitioner-shop-frontend-task3-1.guria.dev
shop-frontend-app › deployed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Task 3. First API with AWS API Gateway and AWS Lambda
1 participant