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 Fluent | |
import Vapor | |
func routes(_ app: Application) throws { | |
app.post("users") { req -> EventLoopFuture<User> in | |
try User.Create.validate(req) | |
let create = try req.content.decode(User.Create.self) | |
guard create.password == create.confirmPassword else { | |
throw Abort(.badRequest, reason: "Passwords did not match") | |
} |