Every failure on the wall’s /problems routes now ends in one error shape, sent from one place, and a crash leaves its stack in your terminal instead of in Ines’s response. The API has a second resource that no lesson has touched: the members’ climbing log. Ines has been reading it, and it’s full of climbs that can’t have happened.
In this project, you’ll harden the log yourself, with the pieces you built for /problems. You’ll check every request it gets, refuse the climbs Ines complains about with the right status, and send every failure from one handler. Start by seeing what the log accepts today.
See What the Log Accepts Today
Members log a climb after they top out on a problem. Each entry in log.json has a string id, the member’s first name, the problemId of the problem they climbed, the climbedOn date, and whether they flashed it, meaning they topped out on their first try:
log.json
[
{ "id": "1", "member": "Mei", "problemId": "2",
"climbedOn": "2026-11-14", "flashed": true },
{ "id": "2", "member": "Tunde", "problemId": "3",
"climbedOn": "2026-11-14", "flashed": false },
{ "id": "3", "member": "Sofia", "problemId": "5",
"climbedOn": "2026-11-21", "flashed": false }
]
The entries are wrapped here for display. The router in routes/log.ts is the one the starting project shipped with. GET /log sends back every climb, and POST /log checks its body by hand:
routes/log.ts
if (
typeof body !== "object" || body === null ||
!("member" in body) || typeof body.member !== "string" ||
!("problemId" in body) || typeof body.problemId !== "string" ||
!("climbedOn" in body) || typeof body.climbedOn !== "string" ||
!("flashed" in body) || typeof body.flashed !== "boolean"
) {
const message =
"Send member, problemId and climbedOn as strings, flashed as true or false.";
res.status(422).json(errorBody("invalid_climb", message));
return;
}
That’s the same kind of check the problems API had in the first lesson: every field present, each of the right type, and nothing about what it holds.
Ines’s list starts with a V14 logged on a wall where nothing goes above V8. Look at the entries again, though: a climb has no grade. It names a problem by its problemId. The grade belongs to that problem in the problems resource you’ve already hardened, where POST /problems refuses a "V14" with a 422.
So the log’s share of this complaint is to accept only a problemId that names a problem on the wall. The log never takes a grade itself, and it doesn’t check the grade of the problem a climb names either.
That leaves one gap you made yourself. Sky Ladder, the V14 you saved in the course’s first lesson, is still active in problems.json because it went in before /problems was hardened.