Skip to content

Adding a TypeScript CloudFront Function Example #36

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gilaniasher
Copy link

Summary

This PR adds a new CloudFront Functions example which demonstrates how to use TypeScript to validate query parameters. The included Webpack config produces a JavaScript file which can be uploaded directly to CloudFront Functions.

The example here also supports unit testing with Jest.

Testing

  • I verified that the code correctly builds when using npm run build and tests pass when running npm run test
  • I uploaded the built JavaScript code from this example to the CloudFront Function console and verified that it works as expected

Successful Request - Lowercase Query Params are Considered Valid
Screenshot 2023-07-27 at 11 43 39 AM

Failed Request - Uppercase Query Params are Considered Invalid
Screenshot 2023-07-27 at 12 18 32 PM


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

1. Includes a Webpack config for bundling the code and producing a format compatible with CloudFront Functions
2. Support for running unit tests
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