How local-heroes-fontys/backend works
Local Heroes Backend is an Express REST API whose implemented product surface is currently a database-aware health check. Requests enter the server, pass through app middleware and API routing, then the health controller asks a service to query MySQL and returns status. Startup configuration, connection pooling, and centralized 404/error handling support that flow. The README describes future feature layers such as repositories, validators, and migrations, but the tree shows no implemented feature modules beyond health; those are not represented as runtime components.
Main entry points: app.ts Express app · server.ts HTTP server · pool.ts MySQL pool · env.ts Validated environment
Components 13
API runtime
- HTTP server
src/server.ts - Express app
src/app.ts - API routes
src/routes/index.ts - Not-found handler
src/middleware/notFound.ts - Error handler
src/middleware/errorHandler.ts - Safe app errors
src/errors/AppError.ts
Health check
- Health route
src/routes/health.routes.ts - Health controller
src/controllers/health.controller.ts - Database health check
src/services/health.service.ts
Configuration and database
- Validated environment
src/config/env.ts - MySQL pool
src/db/pool.ts - MySQL database
Other components
- API caller
Connections 15
- API caller → HTTP server: sends request
README.md - HTTP server → Express app: serves
src/server.ts - HTTP server → Validated environment: reads port
src/server.ts - HTTP server → MySQL pool: closes on shutdown
src/server.ts - Express app → Validated environment: configures CORS
src/app.ts - Express app → API routes: mounts API
src/app.ts - Express app → Not-found handler: falls through to
src/app.ts - Express app → Error handler: handles errors with
src/app.ts - API routes → Health route: mounts health
src/routes/index.ts - Health route → Health controller: dispatches to
src/routes/health.routes.ts - Health controller → Database health check: checks via
src/controllers/health.controller.ts - Database health check → MySQL pool: queries
src/services/health.service.ts - MySQL pool → Validated environment: uses credentials
src/db/pool.ts - MySQL pool → MySQL database: connects to
README.md - Error handler → Safe app errors: recognizes
src/middleware/errorHandler.ts