Skip to content

Instantly share code, notes, and snippets.

@csakis
Created January 16, 2018 23:12
Show Gist options
  • Save csakis/6441e0fad5d6ecb532bb75e37ad34609 to your computer and use it in GitHub Desktop.
Save csakis/6441e0fad5d6ecb532bb75e37ad34609 to your computer and use it in GitHub Desktop.
POST route with Joi validation
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