File tree Expand file tree Collapse file tree 3 files changed +58
-7
lines changed
Examples/HelloWorldVapor/Sources Expand file tree Collapse file tree 3 files changed +58
-7
lines changed Original file line number Diff line number Diff line change 1+ //===----------------------------------------------------------------------===//
2+ //
3+ // This source file is part of the SwiftContainerPlugin open source project
4+ //
5+ // Copyright (c) 2025 Apple Inc. and the SwiftContainerPlugin project authors
6+ // Licensed under Apache License v2.0
7+ //
8+ // See LICENSE.txt for license information
9+ // See CONTRIBUTORS.txt for the list of SwiftContainerPlugin project authors
10+ //
11+ // SPDX-License-Identifier: Apache-2.0
12+ //
13+ //===----------------------------------------------------------------------===//
14+
15+ import Vapor
16+
17+ public func configure( _ app: Application ) async throws {
18+ try routes ( app)
19+ }
Original file line number Diff line number Diff line change 1+ //===----------------------------------------------------------------------===//
2+ //
3+ // This source file is part of the SwiftContainerPlugin open source project
4+ //
5+ // Copyright (c) 2025 Apple Inc. and the SwiftContainerPlugin project authors
6+ // Licensed under Apache License v2.0
7+ //
8+ // See LICENSE.txt for license information
9+ // See CONTRIBUTORS.txt for the list of SwiftContainerPlugin project authors
10+ //
11+ // SPDX-License-Identifier: Apache-2.0
12+ //
13+ //===----------------------------------------------------------------------===//
14+
15+ import Vapor
16+
17+ @main
18+ enum Entrypoint {
19+ static func main( ) async throws {
20+ let env = try Environment . detect ( )
21+ let app = try await Application . make ( env)
22+
23+ do {
24+ try await configure ( app)
25+ try await app. execute ( )
26+ } catch {
27+ app. logger. report ( error: error)
28+ try ? await app. asyncShutdown ( )
29+ throw error
30+ }
31+ try await app. asyncShutdown ( )
32+ }
33+ }
Original file line number Diff line number Diff line change 22//
33// This source file is part of the SwiftContainerPlugin open source project
44//
5- // Copyright (c) 2024 Apple Inc. and the SwiftContainerPlugin project authors
5+ // Copyright (c) 2025 Apple Inc. and the SwiftContainerPlugin project authors
66// Licensed under Apache License v2.0
77//
88// See LICENSE.txt for license information
@@ -17,10 +17,9 @@ import Vapor
1717
1818let myos = ProcessInfo . processInfo. operatingSystemVersionString
1919
20- let app = try Application ( . detect( ) )
21- app. http. server. configuration. hostname = " 0.0.0.0 "
22- defer { app. shutdown ( ) }
20+ func routes( _ app: Application ) throws {
2321
24- app. get { _ in " Hello World, from Vapor on \( myos) \n " }
25-
26- try app. run ( )
22+ app. get { req async in
23+ " Hello World, from Vapor on \( myos) \n "
24+ }
25+ }
You can’t perform that action at this time.
0 commit comments