Skip to content

Instantly share code, notes, and snippets.

@flandy84
Created April 6, 2016 08:10
Show Gist options
  • Save flandy84/27128286fd045ecc04a6d63d017954ce to your computer and use it in GitHub Desktop.
Save flandy84/27128286fd045ecc04a6d63d017954ce to your computer and use it in GitHub Desktop.
import Inquiline
import Swifton
import SharedCode
class LoginController: Controller {
override init() {
super.init()
action("login") {request in
let loginRequest = LoginRequest(json: JSON.parse(request.body ?? ""))
let loginResponse = LoginResponse(text: "Hallo \(loginRequest.userId)")
return Response(.Ok, contentType: "application/json; charset=utf8", body: loginResponse.toJSON().rawString())
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment