Skip to content

Commit e90bb2c

Browse files
Update Hummingbird example to use asyncRun() API (#452)
### Motivation Similar to #451, Hummingbird also now provides an `asyncRun() async` API for running the server to replace the blocking `run()`. We should make an effort to use this better API in our example that uses Hummingbird. ### Modifications Update the Hummingbird example to use async execute() API. ### Result The Hummingbird examples use async execute() API. ### Test Plan CI.
1 parent 23e6592 commit e90bb2c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Examples/HelloWorldHummingbirdServer/Sources/HelloWorldHummingbirdServer/HelloWorldHummingbirdServer.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ struct Handler: APIProtocol {
2424
}
2525

2626
@main struct HelloWorldHummingbirdServer {
27-
static func main() throws {
27+
static func main() async throws {
2828
let app = Hummingbird.HBApplication()
2929
let transport = HBOpenAPITransport(app)
3030
let handler = Handler()
3131
try handler.registerHandlers(on: transport, serverURL: URL(string: "/api")!)
32-
try app.run()
32+
try await app.asyncRun()
3333
}
3434
}

0 commit comments

Comments
 (0)