© Christopher Pitt 2018
Christopher PittThe Definitive Guide to AdonisJshttps://doi.org/10.1007/978-1-4842-3390-0_10

10. Validation and Errors

Christopher Pitt1 
(1)
Cape Town, Western Cape, South Africa
 

In the previous chapter, we learned about databases. This got us most of the way to building our registration and login forms. One topic we didn’t spend enough time on was how to respond in the absence or poor formatting of data.

In this chapter, we’re going to start validating our forms. We’ll learn how to make fields required, how to enforce the format of the data we do get, and how to display validation errors to the user. We’ll also look at how to customize error pages for all the common types of errors users are bound to see.

Installing Validation ...

Get The Definitive Guide to AdonisJs: Building Node.js Applications with JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.