Available

Express API Validation Essentials

Take care of validation in your Express APIs once and for all

64-page DRM-free Ebook

JSON Schema Cheat Sheet PDF

Lifetime access

Express API Validation Essentials

A complex topic condensed into a well thought-out guide. The research has been done for me and I get to follow along. All design decisions are explained to aid with understanding. Brilliant!

User input can be dangerous. You already know you need to validate any data your Express API receives. Without it, your API could crash horribly when it receives badly formatted data. You might end up with an unmaintainable database full of junk data. 

Skipping out on validation leaves you vulnerable. Without it you could end up leaking sensitive user data. Or worse, you could lose control of your servers and be held to ransom by malicious attackers. 
Eek, the thought of getting API validation wrong is kinda scary. 

You want to avoid all these potential headaches. You sit down with Express and try and put in place all the things you need for a great API validation solution:
  • Parsing requests
  • Validating requests
  • Sending back validation errors in a useful format
It seems simple at first, but you quickly end up overwhelmed. You get stuck trying to choose from a whole heap of different validation libraries. You're not sure how to properly integrate the library you've picked with Express. But wait, you also need to figure out what to do with validation errors... and then you need to invent your own error response format too?!
It's all very confusing. 

To make it worse, you can't seem to find any API validation best practices for the Express framework. What you have works, but it's clumsy. You're worried that you're doing it the wrong way.
You know there must be a better way to handle validation in your Express APIs, but you don't know what it is. 

What if you had a go-to validation library? A library which you trusted and could integrate into your Express APIs with ease. 

Wouldn't it be amazing if you knew how to send awesome, standardized error responses? 

You could confidently apply validation best practices to every Express API you create. You would be able to focus your time on building features. You would have validation taken care of. 

Implementing validation in Express APIs takes up way more of your time than it should. 
But it doesn't have to be that way. 

Learn the essentials of Express API validation with my book. With it you'll gain a deep understanding of "the Express way" for validation. Learn how to validate requests and send back awesome error responses with ease. Discover the power of the JSON Schema and Problem Details specifications. Then use them to help you conquer validation in Express.
What's inside the book?

  • A guide to the different types of Express middleware, and how to combine them to do validation "the Express way". 
  • An introduction to the JSON Schema specification and the Ajv library. Two powerful tools for validating requests. 
  • What the Problem Details specification is all about. How you can apply it as a format for sending helpful and consistent error responses. 
  • Recipes for common validation scenarios. Setting default values, providing custom error messages and validating your schemas. 
  • Full working code examples which you can run and try for yourself. 
Learn a complete API validation strategy you can start applying today. 

Take care of validation in your Express APIs once and for all and buy my book. You'll be fearlessly validating requests in no time.

You'll get...

  • The book in PDF format (light and dark)
  • Access to the online version of the book
  • Full code examples
  • My JSON Schema Cheat Sheet

Concise and a pleasure to read. This book has clarified concepts for me that I couldn't get right even after years of consulting the Express documentation.

About The Author

Hi, I’m Simon Plenderleith. I’m an independent Node.js consultant and educator.

Since the day I learnt HTML from a book in 1999, I’ve been hooked on coding. Over the past twenty years I’ve crafted web applications and tooling for many companies, big and small.

I’ve spent a lot of time designing pragmatic processes for people and software. I’ve also been lucky enough to have helped build and lead some fantastic cross-functional teams.

I help companies use Node.js to ship great products that grow their businesses. I also help developers level up with Node.js through my blog, and I’m the author of the book Express API Validation Essentials.

Table of Contents

What's inside the book?

  • 1. Preface
    • 1.1. What you're going to learn
    • 1.2. What you'll need to get the most from this book
    • 1.3. Code examples
    • 1.4. Get in touch
  • 2. Part 1: Doing things the Express way
    • 2.1. Part 1: Doing things the Express way
    • 2.2. The middleware pattern
    • 2.3. The two types of middleware
    • 2.4. Using middleware
    • 2.5. Middleware in a validation strategy
    • 2.6. Summary
  • 3. Part 2: Validating requests
    • 3.1. Part 2: Validating requests
    • 3.2. The JSON Schema specification
    • 3.3. Ajv (Another JSON Schema Validator)
    • 3.4. Learning JSON Schema
    • 3.5. Why use JSON Schema and not validation library X?
    • 3.6. Sidenote: JSON (JavaScript Object Notation) vs JavaScript objects
    • 3.7. Create a validation pipeline with JSON Schema
    • 3.8. Parsing a JSON request body in Express
    • 3.9. Defining JSON schemas in Node.js
    • 3.10. Integrating Ajv into your Express application
    • 3.11. Using a JSON schema to validate a response body
    • 3.12. Validating other request properties
    • 3.13. Summary
  • 4. Part 3: Error responses
    • 4.1. Part 3: Error responses
    • 4.2. Introducing the 'Problem Details for HTTP APIs' specification
    • 4.3. Problem types and Problem details objects
    • 4.4. Example problem details response
    • 4.5. Sending validation errors in problem details responses
    • 4.6. Summary
  • 5. Part 4: Putting it all together
    • 5.1. Part 4: Putting it all together
    • 5.2. Example Express API application
    • 5.3. Example requests and responses
    • 5.4. Summary
  • 6. Recipes
    • 6.1. Recipes
    • 6.2. 1. Validating your schemas
    • 6.3. 2. Setting default values
    • 6.4. 3. Custom error messages

Pricing

Get instant access & start learning right away

Risk-free 30-day refund policy. No questions asked.

What's included

  • 64-page DRM-free Ebook

  • Download ebook and read offline in PDF (light and dark colour schemes)

  • JSON Schema Cheat Sheet PDF

  • Mobile-friendly reading

  • Full code examples

  • Read online in your browser

  • Access to discussion forum

  • Lifetime access

Pay once, own it forever

$19
30-day refund policy

Frequently asked questions

Can’t find the answer you’re looking for? Email [email protected] with your question.

Is this a one-time fee or a recurring subscription?
This is a one-time fee. You will only be charged once.
How long will I have access to the content?
You will have unlimited lifetime access to the content. You can use it any time at your own convenience.
What happens if I'm not happy with my purchase? What is your refund policy?
We have a completely risk-free refund policy. If you're not happy with your purchase for any reason, you can get a full refund within 30 days of your purchase. Just email [email protected] with the email address you purchased with and your receipt number.

Ready to dive in? Get instant access right away.