How cesarmanzano1/proyectom2_manzano-cesar-luis- works
This is an Express REST API for managing authors and posts. Clients call the server’s health, author, and post endpoints; routes apply validation where configured, controllers shape responses and call services, and services issue PostgreSQL queries. Startup checks the database connection, creates the authors/posts tables, then listens for requests. The README also documents interactive Swagger/OpenAPI, which is served by the server. Relationships are limited to those shown in the excerpts or explicitly documented; no controller, router, or middleware behavior beyond the excerpts is inferred.
Main entry points: dbConnect.js Database connection · router.js API routes · server.js Express server · index.js Startup
Components 15
API entry
- Startup
index.js - Express server
src/server.js - API routes
src/router/router.js - Validation middleware
src/middleware/middleware.js - OpenAPI docs
src/swagger.js
Author and post APIs
- Health check
src/controllers/health.controller.js - Author controller
src/controllers/authors.Controller.js - Post controller
src/controllers/post.Controller.js - Author service
src/services/authors.service.js - Post service
src/services/post.service.js
Persistence
- Database connection
src/config/dbConnect.js - DB settings
src/config/constsConfig.js - Schema initialization
src/config/initDB.js - PostgreSQL
Other components
- API clients
Connections 19
- API clients → Express server: send requests
README.md - Express server → API routes: dispatches requests
src/server.js - API routes → Health check: routes health
src/router/router.js - API routes → Author controller: routes authors
src/router/router.js - API routes → Post controller: routes posts
src/router/router.js - API routes → Validation middleware: applies validation
src/router/router.js - Author controller → Author service: calls
src/controllers/authors.Controller.js - Post controller → Post service: calls
src/controllers/post.Controller.js - Post controller → Author service: checks author
src/controllers/post.Controller.js - Author service → Database connection: queries
src/services/authors.service.js - Post service → Database connection: queries
src/services/post.service.js - Database connection → DB settings: loads settings
src/config/dbConnect.js - Database connection → PostgreSQL: connects
src/config/dbConnect.js - Startup → Database connection: checks connection
index.js - Startup → Schema initialization: initializes schema
index.js - Schema initialization → Database connection: creates tables
src/config/initDB.js - Startup → Express server: starts listener
index.js - Express server → OpenAPI docs: serves docs
src/server.js - Express server → Validation middleware: uses logger
src/server.js