So far, your APIs have answered every request. Now, you decide what they refuse, and what they say.
Here’s a first taste, from Crux Corner, a climbing wall in an old school gym. Someone sends its API a new boulder problem graded V14, but the grades stop at V10. The finished API refuses it with a 422 that names the grade:
$ curl -i -H "Content-Type: application/json" \
-d '{"name":"Sky Ladder","colour":"black","grade":"V14","setOn":"2026-11-26"}' \
http://localhost:3000/problems
HTTP/1.1 422 Unprocessable Entity
...
{"error":{"code":"invalid_body","message":"Check the fields listed in details.",
"details":{"formErrors":[],"fieldErrors":{"grade":["Invalid option: expected one of
\"V0\"|\"V1\"|\"V2\"|\"V3\"|\"V4\"|\"V5\"|\"V6\"|\"V7\"|\"V8\"|\"V9\"|\"V10\""]}}}}
The headers are cut and the command and body are wrapped here for display.
Ines sets the wall’s problems, and the API keeps them. However, the starting API trusts whatever it’s sent, so she keeps finding nonsense. You’ll make it check every request.
What You’ll Learn
By the end of this course, you’ll be able to guard an Express API with middleware and Zod schemas, so every request is checked at the boundary. You’ll also be able to turn every failure into a clear, consistent error response with the right status code.
On the way, you’ll:
- Meet middleware, functions that take turns handling a request
- Validate every request with a Zod schema
- Send every error from one error handler
- Harden the members’ climbing log in a project
Before You Start
You need to know how to write Express 5 routes that read JSON bodies, route parameters, and query strings. You also need Zod from your TypeScript work. And the starting project runs on a current Node LTS.
How the Course Works
The course mixes text lessons and short videos, with a coding exercise after each section. It ends with a project you explain to RealJS’s mentor, then a quiz.
Below this video are the slides and one code download, with the starting project and the finished code. Next up is Send the Wall Some Nonsense, where you get the wall’s API running.