Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save cweinberger/c11104a68449fd887ff10967f57d4c7d to your computer and use it in GitHub Desktop.
Save cweinberger/c11104a68449fd887ff10967f57d4c7d to your computer and use it in GitHub Desktop.
Blog: Vapor 4 - Routing
func routes(_ app: Application) throws {
// 1
// a GET request to /hello1
app.get("hello1") { req -> String in
return "hello1"
}
// 2
// a GET request to /hello2
app.get("hello2") { req -> EventLoopFuture<Response> in
return "hello2".encodeResponse(for: req)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment