Skip to content

Add PUT /users/:id update endpoint - #14

Open
MarkBensch wants to merge 2 commits into
mate-academy:mainfrom
MarkBensch:add-update-user-endpoint
Open

Add PUT /users/:id update endpoint#14
MarkBensch wants to merge 2 commits into
mate-academy:mainfrom
MarkBensch:add-update-user-endpoint

Conversation

@MarkBensch

Copy link
Copy Markdown

What changed

Adds a PUT /users/:id endpoint that lets callers update an existing user's name and email.

  • db/store.js — new updateUser(id, { name, email }) helper; returns the updated user or null if not found
  • routes/users.js — new PUT /:id route wired to the helper

Why

The update-user tests in tests/update-user.test.js were failing (no endpoint existed). This makes them green.

What to test

  • PUT /users/1 with { name, email } → 200 with updated user
  • PUT /users/9999 with valid body → 404
  • PUT /users/1 with only name (missing email) → 400

All 9 tests pass (npm test).

🤖 Generated with Claude Code

MarkBensch and others added 2 commits June 29, 2026 20:58
Returns the mutated user on success, null when the id is not found.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Validates name and email (400), returns 404 when the user doesn't exist,
and 200 with the updated user on success. Adds NOTES.md per project spec.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant