File tree Expand file tree Collapse file tree 2 files changed +8
-11
lines changed Expand file tree Collapse file tree 2 files changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ let package = Package(
13
13
] ,
14
14
dependencies: [
15
15
. package ( url: " https://github.com/apple/swift-openapi-runtime.git " , from: " 1.0.0 " ) ,
16
- . package ( url: " https://github.com/hummingbird-project/hummingbird.git " , branch : " 2.x.x " ) ,
16
+ . package ( url: " https://github.com/hummingbird-project/hummingbird.git " , from : " 2.0.0-alpha.1 " ) ,
17
17
] ,
18
18
targets: [
19
19
. target(
Original file line number Diff line number Diff line change 3
3
Hummingbird transport for [ OpenAPI generator] ( https://github.com/apple/swift-openapi-generator ) .
4
4
5
5
``` swift
6
- // Create your Hummingbird application.
7
- let app = HBApplication ()
8
-
9
- // Create a Hummingbird OpenAPI Transport using your application.
10
- let transport = HBOpenAPITransport (app)
6
+ // Create your router.
7
+ let router = HBRouter ()
11
8
12
9
// Create an instance of your handler type that conforms the generated protocol
13
10
// defining your service API.
14
- let handler = MyServiceAPIImpl ()
11
+ let api = MyServiceAPIImpl ()
15
12
16
13
// Call the generated function on your implementation to add its request
17
14
// handlers to the app.
18
- try handler .registerHandlers (on : transport, serverURL : Servers. server1 () )
15
+ try api .registerHandlers (on : router )
19
16
20
- // Start the app as you would normally.
21
- try app. start ( )
22
- app.wait ()
17
+ // Create the application and run as you would normally.
18
+ let app = HBApplication ( router : router )
19
+ try await app.runService ()
23
20
```
24
21
25
22
## Documentation
You can’t perform that action at this time.
0 commit comments