Implement PUT and PATCH Routes

Add the PUT and PATCH routes to the user router.

Both operations can reuse the update controller, but their validation schemas should differ.

PUT represents replacement of the editable user representation.

PATCH represents partial modification.

The controller should receive the appropriate validated update payload.

User Update Routes
router.put('/:id', updateUser);
router.patch('/:id', updateUser);

Registers the PUT and PATCH endpoints. Different validation middleware will be added to enforce full replacement versus partial updates.

Key Takeaways
  • PUT and PATCH have different API semantics.

  • Both routes may reuse service functionality.

  • Use different validation rules for replacement and partial updates.