Swiftpack.co - hummingbird-project/hummingbird-lambda as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by hummingbird-project.
hummingbird-project/hummingbird-lambda 2.0.0-beta.2
Hummingbird running inside an AWS Lambda
⭐️ 19
🕓 5 weeks ago
macOS
.package(url: "https://github.com/hummingbird-project/hummingbird-lambda.git", from: "2.0.0-beta.2")

Hummingbird Lambda

Run Hummingbird inside an AWS Lambda

Usage

Create struct conforming to LambdaFunction. Setup your application in the init function: add your middleware, add route handlers etc

@main
struct MyHandler: LambdaFunction {
    // define input and output
    typealias Event = APIGatewayRequest
    typealias Output = APIGatewayResponse
    typealias Context = BasicLambdaRequestContext<APIGatewayRequest>
 
    init(_ app: Application) {
        app.middleware.add(LogRequestsMiddleware(.debug))
        app.router.get("hello") { _, _ in
            return "Hello"
        }
    }
}

The Event and Output types define your input and output objects. If you are using an APIGateway REST interface to invoke your Lambda then set these to APIGatewayRequest and APIGatewayResponse respectively. If you are using an APIGateway HTML interface then set these to APIGatewayV2Request and APIGatewayV2Response. If you are using any other Event/Output types you will need to implement the request(context:application:from:) and output(from:) methods yourself.

GitHub

link
Stars: 19
Last commit: 5 weeks ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

Version 2.0.0 Beta 2
5 weeks ago

Minor release changes

  • Include HummingbirdLambdaTesting in list of Package products

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics