Skip to content

Instantly share code, notes, and snippets.

@wess
Created November 4, 2016 16:19
Show Gist options
  • Save wess/25471f5a4cbecc8b9c8443f4365cd1a1 to your computer and use it in GitHub Desktop.
Save wess/25471f5a4cbecc8b9c8443f4365cd1a1 to your computer and use it in GitHub Desktop.
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()
@wess
Copy link
Author

wess commented Nov 4, 2016

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