Expand the catalog API into a full CRUD surface: create products, fetch them by ID, update fields safely, and archive records. You’ll also practice mapping validation failures and conflicts to correct HTTP status codes.
Overview
Syllabus
- Unit 1: Building Products API
- Observe how product creation is validated, saved, and returned
- Implement createProduct() and getProductBySku() in the products repository
- Implement validateCreateProduct() and conflict handling in createProductService()
- Implement the POST action() in app/routes/api.products.ts
- Unit 2: Fetching Specific Products
- Observe how a dynamic product route validates UUIDs and returns 404
- Validate params.id in app/routes/api.products.$id.ts
- Implement NOT_FOUND behavior in getProductService()
- Complete the loader() to return 400/404/200 using shared helpers
- Unit 3: Updating and Archiving Products
- Observe partial updates and soft-delete (archive) behavior
- Build SQL updates for PATCH and soft-delete
- Implement validateUpdateProduct(), updateProductService(), and archiveProductService()
- Wire PATCH and DELETE in app/routes/api.products.$id.ts