How jcondori-ucal/semana-06 works
The repository contains two independent Express/MySQL teaching APIs. Both follow the documented HTTP-to-database pattern: clients call routes, controllers delegate to services, and repositories issue SQL through a MySQL pool. The first demonstrates product CRUD and health checks; the second adds user CRUD, model validation, and HTTP errors. Edges reflect README statements and source-index references; unsampled implementation details are not expanded.
Main entry points: db.js Connection pool · src/app.js Express app · usuario.service.js User service · src/app.js Express app
Components 25
Products API HTTP
- Express app
api-productos-mysql/src/app.js - Server startup
api-productos-mysql/src/server.js - Product routes
api-productos-mysql/src/routes/producto.routes.js - Health route
api-productos-mysql/src/routes/health.routes.js - Product controller
api-productos-mysql/src/controllers/producto.controller.js
Products API data
- Product service
api-productos-mysql/src/services/producto.service.js - Product repository
api-productos-mysql/src/repositories/producto.repository.js - Connection pool
api-productos-mysql/src/config/db.js - DB configuration
api-productos-mysql/src/config/env.js
Store API HTTP
- Express app
tienda-api/src/app.js - Product routes
tienda-api/src/routes/producto.routes.js - User routes
tienda-api/src/routes/usuario.routes.js - Product controller
tienda-api/src/controllers/producto.controller.js - User controller
tienda-api/src/controllers/usuario.controller.js
Store API domain and data
- Product service
tienda-api/src/services/producto.service.js - User service
tienda-api/src/services/usuario.service.js - Product model
tienda-api/src/models/producto.model.js - User model
tienda-api/src/models/usuario.model.js - Product repository
tienda-api/src/repositories/producto.repository.js - User repository
tienda-api/src/repositories/usuario.repository.js - Connection pool
tienda-api/src/config/db.js - HTTP errors
tienda-api/src/utils/http-error.js
Other components
- API client
- MySQL
- MySQL
Connections 32
- API client → Express app: sends HTTP
README.md - Server startup → Express app: starts
api-productos-mysql/src/server.js - Server startup → Connection pool: tests connection
api-productos-mysql/src/server.js - Express app → Product routes: mounts
api-productos-mysql/src/app.js - Express app → Health route: mounts
api-productos-mysql/src/app.js - Product routes → Product controller: dispatches
api-productos-mysql/src/routes/producto.routes.js - Product controller → Product service: calls
api-productos-mysql/src/controllers/producto.controller.js - Product service → Product repository: calls
api-productos-mysql/src/services/producto.service.js - Product repository → Connection pool: queries
api-productos-mysql/src/repositories/producto.repository.js - Connection pool → DB configuration: loads settings
api-productos-mysql/src/config/db.js - Connection pool → MySQL: connects
api-productos-mysql/src/config/db.js - Health route → Connection pool: checks connection
api-productos-mysql/src/routes/health.routes.js - API client → Express app: sends HTTP
README.md - Express app → Product routes: mounts
tienda-api/src/app.js - Express app → User routes: mounts
tienda-api/src/app.js - Express app → Connection pool: checks database
tienda-api/src/app.js - Product routes → Product controller: dispatches
tienda-api/src/routes/producto.routes.js - User routes → User controller: dispatches
tienda-api/src/routes/usuario.routes.js - Product controller → Product service: calls
tienda-api/src/controllers/producto.controller.js - User controller → User service: calls
tienda-api/src/controllers/usuario.controller.js - Product controller → HTTP errors: formats errors
tienda-api/src/controllers/producto.controller.js - User controller → HTTP errors: formats errors
tienda-api/src/controllers/usuario.controller.js - Product service → Product repository: calls
tienda-api/src/services/producto.service.js - User service → User repository: calls
tienda-api/src/services/usuario.service.js - Product service → Product model: validates with
tienda-api/src/services/producto.service.js - User service → User model: validates with
tienda-api/src/services/usuario.service.js - User service → HTTP errors: raises
tienda-api/src/services/usuario.service.js - Product repository → Connection pool: queries
tienda-api/src/repositories/producto.repository.js - User repository → Connection pool: queries
tienda-api/src/repositories/usuario.repository.js - Product repository → Product model: uses
tienda-api/src/repositories/producto.repository.js - User repository → User model: uses
tienda-api/src/repositories/usuario.repository.js - Connection pool → MySQL: connects
tienda-api/src/config/db.js