-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: create event-handler utility workspace (#2858)
Co-authored-by: Alexander Schueren <[email protected]>
- Loading branch information
1 parent
c6c425c
commit 5982f50
Showing
19 changed files
with
334 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ scopes: | |
- commons | ||
- parser | ||
- jmespath | ||
- event-handler | ||
- validation | ||
- batch | ||
- layers | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
--- | ||
title: REST API | ||
description: Core utility | ||
--- | ||
|
||
<!-- markdownlint-disable MD013 --> | ||
???+ warning "Don't use in production (yet)" | ||
This feature is currently under development. As such it's considered not stable and we might make significant breaking changes before going [before its release](https://github.com/aws-powertools/powertools-lambda-typescript/milestone/17){target="_blank"}. You are welcome to [provide feedback](https://github.com/aws-powertools/powertools-lambda-typescript/issues/413){target="_blank"} and [contribute to the project](../../contributing/getting_started.md){target="_blank"}. | ||
|
||
Event handler for Amazon API Gateway REST and HTTP APIs, Application Loader Balancer (ALB), Lambda Function URLs, and VPC Lattice. | ||
|
||
## Key Features | ||
|
||
* Lightweight routing to reduce boilerplate for API Gateway REST/HTTP API, ALB and Lambda Function URLs. | ||
* Support for CORS, binary and Gzip compression, Decimals JSON encoding and bring your own JSON serializer | ||
* Built-in integration with [Parser](../../utilities/parser.md){target="_blank"} for easy payload validation and parsing | ||
* Works with micro function (one or a few routes) and monolithic functions (all routes) | ||
|
||
## Getting started | ||
|
||
???+ tip | ||
All examples shared in this documentation are available within the [project repository](https://github.com/aws-powertools/powertools-lambda-typescript/tree/main/examples/snippets/event-handler){target="_blank"}. | ||
|
||
### Install | ||
|
||
```shell | ||
npm install @aws-lambda-powertools/event-handler | ||
``` | ||
|
||
### Required resources | ||
|
||
If you're using any API Gateway integration, you must have an existing [API Gateway Proxy integration](https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html){target="_blank"} or [ALB](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/lambda-functions.html){target="_blank"} configured to invoke your Lambda function. | ||
|
||
In case of using [VPC Lattice](https://docs.aws.amazon.com/lambda/latest/dg/services-vpc-lattice.html){target="_blank"}, you must have a service network configured to invoke your Lambda function. | ||
|
||
This is the sample infrastructure for API Gateway and Lambda Function URLs we are using for the examples in this documentation. | ||
|
||
???+ info "There is no additional permissions or dependencies required to use this utility." | ||
|
||
=== "API Gateway SAM Template" | ||
|
||
```yaml title="AWS Serverless Application Model (SAM) example" | ||
--8<-- "examples/snippets/event-handler/rest/templates/template.yaml" | ||
``` | ||
|
||
=== "Lambda Function URL SAM Template" | ||
|
||
```yaml title="AWS Serverless Application Model (SAM) example" | ||
--8<-- "examples/event_handler_lambda_function_url/sam/template.yaml" | ||
``` | ||
|
||
<!-- remove line below while editing this doc & put it back until the doc has reached its first draft --> | ||
<!-- markdownlint-disable MD043 --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Powertools for AWS Lambda (TypeScript) - Event Handler Utility | ||
|
||
> [!Warning] | ||
> This feature is currently under development. As such it's considered not stable and we might make significant breaking changes before going [before its release](https://github.com/aws-powertools/powertools-lambda-typescript/milestone/17). You are welcome to [provide feedback](https://github.com/aws-powertools/powertools-lambda-typescript/issues/413) and [contribute to the project](https://docs.powertools.aws.dev/lambda/typescript/latest/contributing/getting_started/). | ||
Powertools for AWS Lambda (TypeScript) is a developer toolkit to implement Serverless [best practices and increase developer velocity](https://docs.powertools.aws.dev/lambda/typescript/latest/#features). | ||
|
||
You can use the library in both TypeScript and JavaScript code bases. | ||
|
||
## Intro | ||
|
||
Event handler for Amazon API Gateway REST and HTTP APIs, Application Loader Balancer (ALB), Lambda Function URLs, and VPC Lattice. | ||
|
||
## Usage | ||
|
||
To get started, install the library by running: | ||
|
||
```sh | ||
npm i @aws-lambda-powertools/event-handler | ||
``` | ||
|
||
> [!Note] | ||
> This readme is a work in progress. | ||
## Contribute | ||
|
||
If you are interested in contributing to this project, please refer to our [Contributing Guidelines](https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/CONTRIBUTING.md). | ||
|
||
## Roadmap | ||
|
||
The roadmap of Powertools for AWS Lambda (TypeScript) is driven by customers’ demand. | ||
Help us prioritize upcoming functionalities or utilities by [upvoting existing RFCs and feature requests](https://github.com/aws-powertools/powertools-lambda-typescript/issues), or [creating new ones](https://github.com/aws-powertools/powertools-lambda-typescript/issues/new/choose), in this GitHub repository. | ||
|
||
## Connect | ||
|
||
- **Powertools for AWS Lambda on Discord**: `#typescript` - **[Invite link](https://discord.gg/B8zZKbbyET)** | ||
- **Email**: <[email protected]> | ||
|
||
## How to support Powertools for AWS Lambda (TypeScript)? | ||
|
||
### Becoming a reference customer | ||
|
||
Knowing which companies are using this library is important to help prioritize the project internally. If your company is using Powertools for AWS Lambda (TypeScript), you can request to have your name and logo added to the README file by raising a [Support Powertools for AWS Lambda (TypeScript) (become a reference)](https://s12d.com/become-reference-pt-ts) issue. | ||
|
||
The following companies, among others, use Powertools: | ||
|
||
- [Hashnode](https://hashnode.com/) | ||
- [Caylent](https://caylent.com/) | ||
- [Trek10](https://www.trek10.com/) | ||
- [Elva](https://elva-group.com) | ||
- [globaldatanet](https://globaldatanet.com/) | ||
- [Bailey Nelson](https://www.baileynelson.com.au) | ||
- [Perfect Post](https://www.perfectpost.fr) | ||
- [Sennder](https://sennder.com/) | ||
- [Certible](https://www.certible.com/) | ||
- [tecRacer GmbH & Co. KG](https://www.tecracer.com/) | ||
- [AppYourself](https://appyourself.net) | ||
- [Alma Media](https://www.almamedia.fi) | ||
|
||
### Sharing your work | ||
|
||
Share what you did with Powertools for AWS Lambda (TypeScript) 💞💞. Blog post, workshops, presentation, sample apps and others. Check out what the community has already shared about Powertools for AWS Lambda (TypeScript) [here](https://docs.powertools.aws.dev/lambda/typescript/latest/we_made_this). | ||
|
||
### Using Lambda Layer | ||
|
||
This helps us understand who uses Powertools for AWS Lambda (TypeScript) in a non-intrusive way, and helps us gain future investments for other Powertools for AWS Lambda languages. When [using Layers](https://docs.powertools.aws.dev/lambda/typescript/latest/#lambda-layer), you can add Powertools as a dev dependency to not impact the development process. | ||
|
||
## License | ||
|
||
This library is licensed under the MIT-0 License. See the LICENSE file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
module.exports = { | ||
displayName: { | ||
name: 'Powertools for AWS Lambda (TypeScript) utility: EVENT HANDLER', | ||
color: 'blue', | ||
}, | ||
runner: 'groups', | ||
moduleNameMapper: { | ||
'^(\\.{1,2}/.*)\\.js$': '$1', | ||
}, | ||
transform: { | ||
'^.+\\.ts?$': 'ts-jest', | ||
}, | ||
moduleFileExtensions: ['js', 'ts'], | ||
collectCoverageFrom: ['**/src/**/*.ts', '!**/node_modules/**'], | ||
testMatch: ['**/?(*.)+(spec|test).ts'], | ||
roots: ['<rootDir>/src', '<rootDir>/tests'], | ||
testPathIgnorePatterns: ['/node_modules/'], | ||
testEnvironment: 'node', | ||
coveragePathIgnorePatterns: ['/node_modules/', 'src/types/index.ts'], | ||
coverageThreshold: { | ||
global: { | ||
statements: 100, | ||
branches: 100, | ||
functions: 100, | ||
lines: 100, | ||
}, | ||
}, | ||
coverageReporters: ['json-summary', 'text', 'lcov'] | ||
}; |
Oops, something went wrong.