   }
   
   /// create auth token for user through basic auth
-  /// - returns on success: json with token
-  /// - returns on failure: json with error (vapors own)
   func login(_ req: Request) throws -> ResponseRepresentable {
     let user = try req.auth.assertAuthenticated(User.self)
     let token = try Token.generate(for: user)

  }
  
  /// return user by auth token
  /// - returns on success: user as json
  /// - returns on failure: error as json (vapors own)
  func getUser(_ req: Request) throws -> ResponseRepresentable {
    let user = try req.auth.assertAuthenticated(User.self)
    return try user.makeJSON()

    apiTokenMW.post("logout", handler: logout)
  }
  
  /// create user out of a json request
  func register(_ req: Request) throws -> ResponseRepresentable {
    guard let json = req.json else {
      return try JSON(node: ["status": 406, "message": "no json provided"])
