import { Pool } from 'pg'; import { config } from './config'; export const db = new Pool({ connectionString: config.databaseUrl, ssl: config.nodeEnv === 'production' ? { rejectUnauthorized: false } : false, max: 10, }); db.on('error', (err) => { console.error('Erreur pool PostgreSQL :', err.message); }); export async function testConnection(): Promise { const client = await db.connect(); client.release(); console.log('✅ PostgreSQL connecté'); }