In this chapter, we've looked at the topic of validation and joi, the object schema validation library used throughout the hapi ecosystem. We looked at the importance of validating our inputs, and how to keep this work manageable by using joi.
Hopefully, this chapter has given you a good grounding in the flexibility of joi, and also in how to make your code more robust and readable so that you can use joi both within or outside of hapi applications. I recommend having a full read of joi's documentation and repo examples before moving on to the next chapter.
One of the drawbacks of joi at the moment is that it only supports server-side validation out of the box. However, as popularity grows, I expect this to change in the future, and with tools such as browserify and webpack, it is possible to use joi in the browser with some work; however, that is outside the scope of this book.
As always, all code samples seen in here as well as some extra material can be found online in the repository...