mirror of
https://github.com/swift-server/swift-aws-lambda-runtime.git
synced 2026-06-02 07:27:33 +00:00
motivation: benchmark for comparison of warm/cold runs changes: * refactor configuration * add mock server that can be used by perf tests * add simple perf test script * change redundant classes to structs, make remaining classes final * make offloading opt-in * safer locking * fix format
30 lines
954 B
Swift
30 lines
954 B
Swift
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This source file is part of the SwiftAwsLambda open source project
|
|
//
|
|
// Copyright (c) 2017-2018 Apple Inc. and the SwiftAwsLambda project authors
|
|
// Licensed under Apache License v2.0
|
|
//
|
|
// See LICENSE.txt for license information
|
|
// See CONTRIBUTORS.txt for the list of SwiftAwsLambda project authors
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
import SwiftAwsLambda
|
|
|
|
private struct Request: Codable {
|
|
let body: String
|
|
}
|
|
|
|
private struct Response: Codable {
|
|
let body: String
|
|
}
|
|
|
|
// in this example we are receiving and responding with codables. Request and Response above are examples of how to use
|
|
// codables to model your reqeuest and response objects
|
|
Lambda.run { (_, request: Request, callback) in
|
|
callback(.success(Response(body: String(request.body.reversed()))))
|
|
}
|