import { Request, Response, NextFunction } from 'express';

export function requestTimeout(req: Request, res: Response, next: NextFunction): void {
  req.setTimeout(15_000, () => {
    if (!res.headersSent) {
      res.status(503).json({ error: 'Request timeout' });
    }
  });
  next();
}
