How makson19/univ_api works
Univ API manages student records through a single /alunos REST workflow: requests enter the Express app, route to student handlers, and return JSON or validation/error responses. Create and update requests are schema-validated; handlers delegate CRUD and paginated listing to the student service, which uses Prisma to query MySQL. The README documents these endpoint capabilities. The graph follows the sampled runtime source; database schema details and any behavior beyond the excerpts are not inferred.
Main entry points: AlunoService.js Student service · alunoRoutes.js Student routes · AlunoController.js Student controller · index.js Express app
Components 13
HTTP API
- Express app
src/index.js - Student routes
src/routes/alunoRoutes.js - Body validation
src/middlewares/validate.js - Student schemas
src/schemas/alunoSchema.js - Student controller
src/controllers/AlunoController.js
Student Domain
- Student service
src/services/AlunoService.js - Student errors
src/errors/AlunoInvalidoError.js - Not-found error
src/errors/AlunoNaoEncontradoError.js - Order error
src/errors/OrderInvalidoError.js
Persistence
- Prisma client
src/databases/prisma.js - MySQL database
- Student data model
prisma/schema.prisma
Other components
- API client
Connections 12
- API client → Express app: sends HTTP
- Express app → Student routes: mounts routes
- Student routes → Body validation: validates create/update
- Body validation → Student schemas: parses body
- Student routes → Student controller: dispatches handlers
- Student controller → Student service: calls operations
- Student service → Prisma client: queries records
- Prisma client → MySQL database: reads/writes
- Student service → Student errors: throws invalid
- Student service → Not-found error: throws missing
- Student service → Order error: throws invalid order
- Student controller → API client: returns HTTP response