Cannot convert type (Request, User)

I am reworking the authentication example and unfortunately this route gives me the error
cannot convert value of type '(Request, User) throws -> EventLoopFuture<User.Public>' to expected argument type '(Request, _) throws -> _'
It should be the same as in the book. Here my route:, use: createHandler) //this is the route that gives me the above error
func createHandler(_ req: Request, user:User) throws → Future<User.Public> {
user.password = try BCrypt.hash(user.password)
return req).convertToPublic()

Ok, sorry. I found the error. In the user model I forgot to make User.Public conform to the protocol Content{}.


1 Like

@arnold_74 Really glad you sorted it out! Cheers! :]