learn hapi — Always Throw and Handle API Validation Errors

Request validation in hapi is a powerful feature and allows you to define fine-grained validation rules. In the previous tutorial, you put validation rules in place for the API TV show endpoint which returns a list of shows.

Failed validations for the page and extend query parameters are handled by hapi and passed through the framework as an error response.

The problem is that hapi generalizes error messages and only tells you the source of the issue, like “Invalid request query input”. This isn’t helpful for requests containing multiple query parameter values.

Follow this tutorial and make it approachable for developers to find the issue with detailed error messages.

hapi Series Overview


Continue reading

University Enrollment Required

Future Students benefit from value packed videos and tutorials.

Enroll to receive exclusive content or sign in if you’re already a Future Student.

Enroll me for $15/mo

Explore the Library

Find interesting tutorials and solutions for your problems.