Created
January 16, 2018 23:12
-
-
Save csakis/6441e0fad5d6ecb532bb75e37ad34609 to your computer and use it in GitHub Desktop.
POST route with Joi validation
This file contains 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
server.route({ | |
method: 'POST', | |
path: '/login', | |
config: { | |
validate: { | |
options: { | |
abortEarly: false | |
}, | |
payload: { | |
username: Joi.string().email().required(), | |
password: Joi.string().required() | |
} | |
} | |
}, | |
handler: (request, h) => { | |
return h.view('login') | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment