Created
November 4, 2016 16:19
-
-
Save wess/25471f5a4cbecc8b9c8443f4365cd1a1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import Vapor | |
let root = Droplet() | |
root.get { req in return try root.view.make("welcome", []) } | |
root.group("v1") { v1 in | |
v1.group("prefs") { prefs in | |
let controller = PrefsController() | |
prefs.get("index", controller.index) | |
prefs.get("update", controller.update) | |
} | |
} | |
root.run() | |
import Vapor
import HTTP
final class PrefsController {
func index(_ request: Request) throws -> ResponseRepresentable {
return "Hello index"
}
func update(_ request: Request) throws -> ResponseRepresentable {
return "Hello update"
}
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Error:
Output:
Compile Swift Module 'App' (3 sources)
/Users/wess/Development/Nudge/services/Sources/App/main.swift:10:11: error: argument labels '(_:, :)' do not match any available overloads
prefs.get("index", controller.index)
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/wess/Development/Nudge/services/Sources/App/main.swift:10:11: note: overloads for 'get' exist with these partially matching parameter lists: (String, handler: @escaping (Request) throws -> ResponseRepresentable), (W0.Type, handler: @escaping (Request, W0) throws -> ResponseRepresentable)
prefs.get("index", controller.index)
^
/Users/wess/Development/Nudge/services/Sources/App/main.swift:11:11: error: argument labels '(:, _:)' do not match any available overloads
prefs.get("update", controller.update)
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/wess/Development/Nudge/services/Sources/App/main.swift:11:11: note: overloads for 'get' exist with these partially matching parameter lists: (String, handler: @escaping (Request) throws -> ResponseRepresentable), (W0.Type, handler: @escaping (Request, W0) throws -> ResponseRepresentable)
prefs.get("update", controller.update)
^