import express from 'express'; import { registerRoutes } from './routes.js'; import { useCors, useLogging } from './middlewares/index.js'; import { initDb } from '#db/index.js'; const app = express(); const PORT = process.env.PORT ?? 3000; const logRequests = process.env['LOG_REQUESTS'] ?? '-'; await initDb(); // Configure Express app.use(express.json()); app.use(useCors); app.disable('x-powered-by'); if (logRequests) { app.use(useLogging(logRequests)); } registerRoutes(app); app.listen(PORT, () => { console.log(`Server is running on http://localhost:${PORT}`); });