throws
is missing. It should be like this:
app.get("hello", ":name") { req async throws -> String in
guard let name = req.parameters.get("name") else {
throw Abort(.badRequest)
}
return "Hello, \(name)!"
}
throws
is missing. It should be like this:
app.get("hello", ":name") { req async throws -> String in
guard let name = req.parameters.get("name") else {
throw Abort(.badRequest)
}
return "Hello, \(name)!"
}
It should be inferred unless something has changed in a new Swift version. If you remove the async throws
it should still compile - at least it does for me