-
Notifications
You must be signed in to change notification settings - Fork 113
/
Copy pathmain.swift
30 lines (24 loc) · 989 Bytes
/
main.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//===----------------------------------------------------------------------===//
//
// This source file is part of the SwiftAWSLambdaRuntime open source project
//
// Copyright (c) 2024 Apple Inc. and the SwiftAWSLambdaRuntime project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of SwiftAWSLambdaRuntime project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import AWSLambdaEvents
import AWSLambdaRuntime
let runtime = LambdaRuntime {
(event: APIGatewayV2Request, context: LambdaContext) -> APIGatewayV2Response in
var header = HTTPHeaders()
context.logger.debug("HTTP API Message received")
header["content-type"] = "application/json"
// echo the request in the response
return try APIGatewayV2Response(statusCode: .ok, headers: header, encodableBody: event)
}
try await runtime.run()