Problem
The API supports listing all items (GET /items), creating (POST /items), updating (PATCH /items/:id), and deleting (DELETE /items/:id) — but there's no way to fetch a single item by its ID. Clients currently have to fetch the entire list and filter client-side, which doesn't scale and is inconsistent with the rest of the CRUD surface.
Proposed change
Add a GET /items/int:item_id route to app.py that:
Returns the matching item as JSON with a 200 status when found.
Returns {"error": "item not found"} with a 404 status when no item matches, consistent with the existing behavior in update_item and delete_item.
Acceptance criteria
GET /items/ returns the item JSON (id, name, done) with status 200 when it exists.
GET /items/ returns status 404 with an error field when the item doesn't exist.
New tests added to test_app.py covering both the found and not-found cases, following the existing test style/fixtures.
README.md's endpoint table is updated to document the new route.
make test and make lint pass.
Notes
This is intentionally small in scope — it's meant to slot cleanly next to the existing list_items/update_item/delete_item handlers without touching item creation or storage logic.
Problem
The API supports listing all items (GET /items), creating (POST /items), updating (PATCH /items/:id), and deleting (DELETE /items/:id) — but there's no way to fetch a single item by its ID. Clients currently have to fetch the entire list and filter client-side, which doesn't scale and is inconsistent with the rest of the CRUD surface.
Proposed change
Add a GET /items/int:item_id route to app.py that:
Returns the matching item as JSON with a 200 status when found.
Returns {"error": "item not found"} with a 404 status when no item matches, consistent with the existing behavior in update_item and delete_item.
Acceptance criteria
GET /items/ returns the item JSON (id, name, done) with status 200 when it exists.
GET /items/ returns status 404 with an error field when the item doesn't exist.
New tests added to test_app.py covering both the found and not-found cases, following the existing test style/fixtures.
README.md's endpoint table is updated to document the new route.
make test and make lint pass.
Notes
This is intentionally small in scope — it's meant to slot cleanly next to the existing list_items/update_item/delete_item handlers without touching item creation or storage logic.