-
-
Save cardoso/e6324000861379344bd12b21a47d91de to your computer and use it in GitHub Desktop.
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
import AWSLambdaEvents | |
import AWSLambdaRuntime | |
import NIO | |
// MARK: - Run Lambda | |
Lambda.run(APIGatewayProxyLambda()) | |
// MARK: - Handler, Request and Response | |
// FIXME: Use proper Event abstractions once added to AWSLambdaRuntime | |
struct APIGatewayProxyLambda: EventLoopLambdaHandler { | |
public typealias In = APIGateway.Request | |
public typealias Out = APIGateway.Response | |
public func handle(context: Lambda.Context, event: APIGateway.Request) -> EventLoopFuture<APIGateway.Response> { | |
context.logger.debug("hello, api gateway!") | |
return context.eventLoop.makeSucceededFuture(APIGateway.Response(statusCode: .ok, body: "Hello, world!")) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment