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 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 available at https://github.com/johnbrett/Getting-Started-with-hapi.js.

If you have any questions about the code samples regarding understanding the code snippets or problems running them, feel free to open an issue.

Let's now move on to the final chapter of this book where we will look at some more tools from the hapi ecosystem, which you'll want to cover before we finally get our hapi applications ready for production.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.168.8