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 available for review, but will be updated #11

Closed
wants to merge 6 commits into from
Closed

task3 available for review, but will be updated #11

wants to merge 6 commits into from

Conversation

Guria
Copy link
Owner

@Guria Guria commented Oct 12, 2022

This is a temporary Pull Request to start review process.
I'd like to better structure changes in commits with proper descriptions.

What is done:

  • BE and FE code organised in a single repo. Organizers answered that it is acceptable.
  • Introduced new separate services: api-gateway and products-api
  • mocks and models moved to shared package
  • api-gateway is made in separate service to make it possible serve all functions services from same gateway
  • products-api implements 2 required functions getProductsList and getProductById
  • Functions implemented in typescript, with async/await and serverless-esbuild plugin. Organizers also confirmed that this counts to gain additional points
  • Both functions are returning mocked responses and exposed at api gateway
  • Config with api gateway url is generated and passed to frontend app during the build (had to inline plugin with fixes for this step)
  • swagger.json for generated api-gateway is downloaded using aws cli and published to frontend app
  • Frontend app includes /swagger role to display Swagger UI
  • Links to working deployment, gateway, swagger etc could be found in following github-actions bot comment
  • PR related deployment will be disposed after PR is closed

What was not done:

  • unit tests
  • main error scenarios handling

See also #3 for previous task implementation as may clarify some setup in the repo

@Guria Guria force-pushed the task3 branch 3 times, most recently from e182767 to a07bc4c Compare October 12, 2022 23:56
@github-actions
Copy link

github-actions bot commented Oct 12, 2022

Build output

Deploying to stage task3
api-gw › waiting
products-api › waiting
shop-frontend-app › waiting
api-gw › deploying
api-gw › Running "serverless deploy --stage task3"
api-gw › Deploying aws-js-practitioner-api to stage task3 (us-east-1)
api-gw › Change set did not include any changes to be deployed. (4s)
api-gw › Running "serverless info --verbose --stage task3"
api-gw › service: aws-js-practitioner-api
api-gw › stage: task3
api-gw › region: us-east-1
api-gw › stack: aws-js-practitioner-api-task3
api-gw ›
api-gw › Stack Outputs:
api-gw › apiGatewayRestApiId: z1zgz7nil9
api-gw › apiGatewayRestApiRootResourceId: 4s06r2rjjb
api-gw › ServerlessDeploymentBucketName: aws-js-practitioner-api-serverlessdeploymentbuck-1u6ovyonjlm7v
api-gw › deployed
products-api › deploying
products-api › Running "serverless deploy --stage task3 --param apiGatewayRestApiId=z1zgz7nil9 --param apiGatewayRestApiRootResourceId=4s06r2rjjb"
products-api › Deploying products-api to stage task3 (us-east-1)
products-api › No changes to deploy. Deployment skipped. (2s)
products-api › Running "serverless info --verbose --stage task3 --param apiGatewayRestApiId=z1zgz7nil9 --param apiGatewayRestApiRootResourceId=4s06r2rjjb"
products-api › service: products-api
products-api › stage: task3
products-api › region: us-east-1
products-api › stack: products-api-task3
products-api › endpoints:
products-api › GET - https://z1zgz7nil9.execute-api.us-east-1.amazonaws.com/task3/products
products-api › GET - https://z1zgz7nil9.execute-api.us-east-1.amazonaws.com/task3/products/{productId}
products-api › functions:
products-api › getProductsList: products-api-task3-getProductsList
products-api › getProductById: products-api-task3-getProductById
products-api › Stack Outputs:
products-api › GetProductByIdLambdaFunctionQualifiedArn: arn:aws:lambda:us-east-1:609136581632:function:products-api-task3-getProductById:2
products-api › GetProductsListLambdaFunctionQualifiedArn: arn:aws:lambda:us-east-1:609136581632:function:products-api-task3-getProductsList:2
products-api › ServiceEndpoint: https://z1zgz7nil9.execute-api.us-east-1.amazonaws.com/task3
products-api › ServerlessDeploymentBucketName: products-api-task3-serverlessdeploymentbucket-15s1rjgavxdd4
products-api › no changes
shop-frontend-app › deploying
shop-frontend-app › Running "serverless deploy --stage task3 --param apiGatewayRestApiId=z1zgz7nil9 --param productsApiServiceEndpoint=https://z1zgz7nil9.execute-api.us-east-1.amazonaws.com/task3"
shop-frontend-app › Deploying aws-js-practitioner-shop-frontend to stage task3 (us-east-1)
shop-frontend-app › Running command: aws apigateway get-export --parameters extensions='apigateway' --rest-api-id z1zgz7nil9 --stage-name task3 --export-type swagger public/swagger.json
shop-frontend-app › echo "CONFIG = {BASE_URL: "https://z1zgz7nil9.execute-api.us-east-1.amazonaws.com/task3\"}" > public/config.js
shop-frontend-app › npm run build
shop-frontend-app › {
shop-frontend-app › "contentType": "application/octet-stream",
shop-frontend-app › "contentDisposition": "attachment; filename="swagger_2022-10-17T19:55:43Z.json""
shop-frontend-app › }
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 › ✓ 3423 modules transformed.
shop-frontend-app › warnings when minifying css:
shop-frontend-app › ▲ [WARNING] Expected identifier but found "*" [css-syntax-error]
shop-frontend-app ›
shop-frontend-app › :1:30219:
shop-frontend-app › 1 │ ...fter{clear:both}.swagger-ui .cf{*zoom:1}.swagger-ui .cl{clear:le...
shop-frontend-app › ╵ ^
shop-frontend-app ›
shop-frontend-app ›
shop-frontend-app › rendering chunks...
shop-frontend-app › dist/index.html 0.64 KiB
shop-frontend-app › dist/assets/dehydrated.eb01c8e5.js 0.58 KiB / gzip: 0.33 KiB
shop-frontend-app › dist/assets/SwaggerStyles.b21286a4.js 0.05 KiB / gzip: 0.06 KiB
shop-frontend-app › dist/assets/SwaggerStyles.e392df80.css 140.02 KiB / gzip: 22.23 KiB
shop-frontend-app › dist/assets/libs.f5f78b2b.js 115.30 KiB / gzip: 38.24 KiB
shop-frontend-app › dist/assets/index.6b686a0f.js 216.23 KiB / gzip: 65.57 KiB
shop-frontend-app › dist/assets/react.988ba9ed.js 198.68 KiB / gzip: 60.68 KiB
shop-frontend-app › dist/assets/swagger.c4dd6200.js 898.55 KiB / gzip: 281.32 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://d2gvc8gt33av4p.cloudfront.net
shop-frontend-app › * https://aws-js-practitioner-shop-frontend-task3.guria.dev
shop-frontend-app › Swagger Schema available at:
shop-frontend-app › * https://aws-js-practitioner-shop-frontend-task3.guria.dev/swagger.json
shop-frontend-app › Swagger UI available at:
shop-frontend-app › * https://aws-js-practitioner-shop-frontend-task3.guria.dev/swagger
shop-frontend-app › Change set did not include any changes to be deployed. (50s)
shop-frontend-app › Running "serverless info --verbose --stage task3 --param apiGatewayRestApiId=z1zgz7nil9 --param productsApiServiceEndpoint=https://z1zgz7nil9.execute-api.us-east-1.amazonaws.com/task3"
shop-frontend-app › service: aws-js-practitioner-shop-frontend
shop-frontend-app › stage: task3
shop-frontend-app › region: us-east-1
shop-frontend-app › stack: aws-js-practitioner-shop-frontend-task3
shop-frontend-app ›
shop-frontend-app › Stack Outputs:
shop-frontend-app › WebAppDistributionIdOutput: EZI3VO5R8HQRD
shop-frontend-app › WebAppDistributionOutput: d2gvc8gt33av4p.cloudfront.net
shop-frontend-app › ServerlessDeploymentBucketName: aws-js-practitioner-shop-serverlessdeploymentbuck-hjxr61423sgz
shop-frontend-app › WebAppCustomDomainOutput: aws-js-practitioner-shop-frontend-task3.guria.dev
shop-frontend-app › deployed

@Guria Guria force-pushed the task3 branch 5 times, most recently from 6124496 to b985bf1 Compare October 13, 2022 07:15
@Guria Guria changed the title temp pr to test task3 task3 available for review, but will be updated Oct 13, 2022
Guria added 4 commits October 17, 2022 20:04
✔️ 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 `getProductsById` in Product Service which will be triggered by the HTTP GET method.
✔️ The requested URL should be `/products/{productId}`
✔️ The response from the lambda should be 1 searched product from an array of products (mock data should be used).

Extra effort:
* This endpoint is integrated with Frontend app. New route and components set is created
* Business logic moved from handler code to a service class
@Guria Guria force-pushed the task3 branch 3 times, most recently from bfc4609 to c7702a7 Compare October 17, 2022 20:26
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.

1 participant