import { Pool } from "pg"; let pool: Pool | null = null; export function getPool(): Pool { if (!pool) { pool = new Pool({ connectionString: process.env.DATABASE_URL, max: 10, idleTimeoutMillis: 30_000, connectionTimeoutMillis: 5_000, }); } return pool; } export async function closePool(): Promise { if (pool) { await pool.end(); pool = null; } }