|
@@ -5,7 +5,7 @@ struct Object: HBResponseEncodable {
|
|
let message: String
|
|
let message: String
|
|
}
|
|
}
|
|
|
|
|
|
-func runApp() {
|
|
|
|
|
|
+func runApp() throws {
|
|
let env = HBEnvironment()
|
|
let env = HBEnvironment()
|
|
let serverHostName = env.get("SERVER_HOSTNAME") ?? "127.0.0.1"
|
|
let serverHostName = env.get("SERVER_HOSTNAME") ?? "127.0.0.1"
|
|
let serverPort = env.get("SERVER_PORT", as: Int.self) ?? 8080
|
|
let serverPort = env.get("SERVER_PORT", as: Int.self) ?? 8080
|
|
@@ -17,7 +17,7 @@ func runApp() {
|
|
)
|
|
)
|
|
let app = HBApplication(configuration: configuration)
|
|
let app = HBApplication(configuration: configuration)
|
|
app.encoder = JSONEncoder()
|
|
app.encoder = JSONEncoder()
|
|
-
|
|
|
|
|
|
+
|
|
app.router.get("plaintext") { req in
|
|
app.router.get("plaintext") { req in
|
|
"Hello, world!"
|
|
"Hello, world!"
|
|
}
|
|
}
|
|
@@ -26,8 +26,8 @@ func runApp() {
|
|
Object(message: "Hello, world!")
|
|
Object(message: "Hello, world!")
|
|
}
|
|
}
|
|
|
|
|
|
- app.start()
|
|
|
|
|
|
+ try app.start()
|
|
app.wait()
|
|
app.wait()
|
|
}
|
|
}
|
|
|
|
|
|
-runApp()
|
|
|
|
|
|
+try runApp()
|