Skip to content

Commit c936a7e

Browse files
committed
add an lambda event example in the readme file
1 parent 3f0cd25 commit c936a7e

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

readme.md

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ let runtime = LambdaRuntime {
179179
try await runtime.run()
180180
```
181181

182-
You can learn how to deploy and invoke this function in [the example README file](Examples/HelloJSON/README.md).
182+
You can learn how to deploy and invoke this function in [the Hello JSON example README file](Examples/HelloJSON/README.md).
183183

184184
### Lambda Streaming Response
185185

@@ -216,7 +216,30 @@ let runtime = LambdaRuntime.init(handler: SendNumbersWithPause())
216216
try await runtime.run()
217217
```
218218

219-
You can learn how to deploy and invoke this function in [the example README file](Examples/Streaming/README.md).
219+
You can learn how to deploy and invoke this function in [the streaming example README file](Examples/Streaming/README.md).
220+
221+
### Integration with AWS Services
222+
223+
Most Lambda functions are triggered by events originating in other AWS services such as `Amazon SNS`, `Amazon SQS` or `AWS APIGateway`.
224+
225+
The [Swift AWS Lambda Events](http://github.com/swift-server/swift-aws-lambda-events) package includes an `AWSLambdaEvents` module that provides implementations for most common AWS event types further simplifying writing Lambda functions.
226+
227+
Here is an example Lambda function invoked when the AWS APIGateway receives an HTTP request.
228+
229+
```swift
230+
import AWSLambdaEvents
231+
import AWSLambdaRuntime
232+
233+
let runtime = LambdaRuntime {
234+
(event: APIGatewayV2Request, context: LambdaContext) -> APIGatewayV2Response in
235+
236+
APIGatewayV2Response(statusCode: .ok, body: "Hello World!")
237+
}
238+
239+
try await runtime.run()
240+
```
241+
242+
You can learn how to deploy and invoke this function in [the API Gateway example README file](Examples/APIGateway/README.md).
220243

221244
### Integration with Swift Service LifeCycle
222245

@@ -269,7 +292,7 @@ let runtime = LambdaRuntime.init(handler: adapter)
269292
try await runtime.run()
270293
```
271294

272-
You can learn how to deploy and invoke this function in [the example README file](Examples/BackgroundTasks/README.md).
295+
You can learn how to deploy and invoke this function in [the background tasks example README file](Examples/BackgroundTasks/README.md).
273296

274297
## Deploying your Swift Lambda functions
275298

0 commit comments

Comments
 (0)