Summary

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 ...

Get Getting Started with hapi.js 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.