Construire une API REST complète pour une application de gestion d'inventaire, avec Express, pg (node-postgres), pattern Repository, transactions et export CSV en streaming.
Durée estimée : 4–5 heures
GET /products — liste paginée (limit, offset, category, search)
GET /products/:id — détail produit + stock
POST /products — créer (transaction si stock initial)
PUT /products/:id — modifier
DELETE /products/:id — désactiver (soft delete)
POST /orders — créer commande (transaction multi-tables)
GET /orders/:id — détail commande avec lignes
GET /export/orders?year= — export CSV streaming
GET /health — statut DB + latence
src/
├── db.js — pool + healthCheck
├── repositories/
│ ├── productRepository.js
│ └── orderRepository.js
├── routes/
│ ├── products.js
│ ├── orders.js
│ └── export.js
├── middleware/
│ └── errorHandler.js
└── index.js