Last active
April 9, 2020 09:59
-
-
Save cweinberger/c11104a68449fd887ff10967f57d4c7d to your computer and use it in GitHub Desktop.
Blog: Vapor 4 - Routing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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