How martinfmelendez/coderhouse-backend-3 works
Shipnow is a small Express/Mongoose products API. A client request enters the app, is routed to the products controller, and proceeds through the service and repository to the Mongo persistence adapter; the controller returns the result as JSON. Startup loads required environment variables, starts the HTTP listener, and connects to MongoDB. Product schema and status constants represent the persistence model. Error middleware is registered globally; the excerpts show the controller forwarding failures, but not the full Express error-dispatch path.
Main entry points: app.js Express App · server.js HTTP Server · products.controller.js Products Controller · configDB.js Database Connection
Components 15
HTTP API
- Express App
src/app.js - API Router
src/routers/index.router.js - Products Route
src/routers/products.router.js - Error Handler
src/middlewares/errorHanddler.js
Product Workflow
- Products Controller
src/controllers/products.controller.js - Products Service
src/services/products.service.js - Products Repository
src/repositories/products.repository.js - Product Status Constants
src/utils/products.constants.js
Persistence
- Products Mongo Adapter
src/DAO/mongo/products.mongo.js - Product Model
src/DAO/models/products.model.js
Runtime Setup
- HTTP Server
src/server.js - Environment Config
src/config/variablesEnv.js - Database Connection
src/config/configDB.js
Other components
- API Client
- MongoDB
Connections 16
- API Client → Express App: sends request
src/app.js - Express App → API Router: mounts at /api
src/app.js - Express App → Error Handler: registers handler
src/app.js - API Router → Products Route: mounts /products
src/routers/index.router.js - Products Route → Products Controller: handles GET
src/routers/products.router.js - Products Controller → Products Service: requests products
src/controllers/products.controller.js - Products Service → Products Repository: gets products
src/services/products.service.js - Products Repository → Products Mongo Adapter: delegates query
src/repositories/products.repository.js - Products Mongo Adapter → Product Model: imports model
src/DAO/mongo/products.mongo.js - Product Model → Product Status Constants: uses status
src/DAO/models/products.model.js - Products Controller → Error Handler: forwards errors
- HTTP Server → Express App: starts listener
src/server.js - HTTP Server → Environment Config: reads port
src/server.js - HTTP Server → Database Connection: connects on startup
src/server.js - Database Connection → Environment Config: reads URI
src/config/configDB.js - Database Connection → MongoDB: connects
src/config/configDB.js