Downloads
-
Preface
- What you're going to learn
- What you'll need to get the most from this book
- Code examples
- Get in touch
-
Part 1: Doing things the Express way
- Part 1: Doing things the Express way
- The middleware pattern
- The two types of middleware
- Using middleware
- Middleware in a validation strategy
- Summary
-
Part 2: Validating requests
- Part 2: Validating requests
- The JSON Schema specification
- Ajv (Another JSON Schema Validator)
- Learning JSON Schema
- Why use JSON Schema and not validation library X?
- Sidenote: JSON (JavaScript Object Notation) vs JavaScript objects
- Create a validation pipeline with JSON Schema
- Parsing a JSON request body in Express
- Defining JSON schemas in Node.js
- Integrating Ajv into your Express application
- Using a JSON schema to validate a response body
- Validating other request properties
- Summary
-
Part 3: Error responses
- Part 3: Error responses
- Introducing the 'Problem Details for HTTP APIs' specification
- Problem types and Problem details objects
- Example problem details response
- Sending validation errors in problem details responses
- Summary
-
Part 4: Putting it all together
- Part 4: Putting it all together
- Example Express API application
- Example requests and responses
- Summary
-
Recipes