| /** | |
| * Application entry point. | |
| * @module main | |
| */ | |
| import express, { Request, Response } from 'express'; | |
| import cors from 'cors'; | |
| import helmet from 'helmet'; | |
| import dotenv from 'dotenv'; | |
| import { logger } from './utils/logger.js'; | |
| dotenv.config(); | |
| const app = express(); | |
| const PORT = process.env.PORT ?? 3000; | |
| // Middleware | |
| app.use(helmet()); | |
| app.use(cors()); | |
| app.use(express.json()); | |
| // Health check | |
| app.get('/health', (_req: Request, res: Response): void => { | |
| res.json({ status: 'ok', app: process.env.APP_NAME ?? 'MyApp' }); | |
| }); | |
| app.listen(PORT, () => { | |
| logger.info(`Server running on port ${PORT}`); | |
| }); | |
| export { app }; | |