MVP Build

This commit is contained in:
Eric Gullickson
2025-08-09 12:47:15 -05:00
parent 2e8816df7f
commit 8f5117a4e2
92 changed files with 5910 additions and 0 deletions

48
backend/src/app.ts Normal file
View File

@@ -0,0 +1,48 @@
/**
* @ai-summary Express app configuration with feature registration
* @ai-context Each feature capsule registers its routes independently
*/
import express from 'express';
import cors from 'cors';
import helmet from 'helmet';
import { errorHandler } from './core/middleware/error.middleware';
import { requestLogger } from './core/middleware/logging.middleware';
export const app = express();
// Core middleware
app.use(helmet());
app.use(cors());
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use(requestLogger);
// Health check
app.get('/health', (_req, res) => {
res.json({
status: 'healthy',
timestamp: new Date().toISOString(),
environment: process.env.NODE_ENV,
features: ['vehicles', 'fuel-logs', 'stations', 'maintenance']
});
});
// Import all feature route registrations
import { registerVehiclesRoutes } from './features/vehicles';
import { registerFuelLogsRoutes } from './features/fuel-logs';
import { registerStationsRoutes } from './features/stations';
// Register all feature routes
app.use(registerVehiclesRoutes());
app.use(registerFuelLogsRoutes());
app.use(registerStationsRoutes());
// 404 handler
app.use((_req, res) => {
res.status(404).json({ error: 'Route not found' });
});
// Error handling (must be last)
app.use(errorHandler);
export default app;