How alura-cursos/api-node-express-2 works
This is a small Express API for managing books and authors. Clients send HTTP requests through the server and registered routes; controllers perform the requested catalog operations through Mongoose models, which use the configured MongoDB connection. Books can be searched by publisher and include populated author data. The README identifies the project as course material but documents no further capabilities; the graph follows the sampled source.
Main entry points: app.js Express app · index.js Route registry · livrosController.js Book controller · autoresController.js Author controller
Components 12
HTTP runtime
- HTTP server
server.js - Express app
src/app.js - Route registry
src/routes/index.js
Catalog API
- Book routes
src/routes/livrosRoutes.js - Author routes
src/routes/autoresRoutes.js - Book controller
src/controllers/livrosController.js - Author controller
src/controllers/autoresController.js
Persistence
- Book model
src/models/Livro.js - Author model
src/models/Autor.js - Mongo connection
src/config/dbConnect.js
Other components
- API client
- MongoDB
Connections 14
- HTTP server → Express app: starts
- API client → HTTP server: sends HTTP
- Express app → Route registry: registers routes
- Express app → Mongo connection: monitors connection
- Route registry → Book routes: mounts
- Route registry → Author routes: mounts
- Book routes → Book controller: dispatches
- Author routes → Author controller: dispatches
- Book controller → Book model: queries and writes
- Author controller → Author model: queries and writes
- Book model → Author model: populates author
- Mongo connection → MongoDB: connects
- Book controller → API client: sends response
- Author controller → API client: sends response