import { Pool } from 'pg'; import dotenv from 'dotenv'; dotenv.config(); const pool = new Pool({ connectionString: process.env.DATABASE_URL || 'postgresql://postgres:changeme@localhost:5432/vip_coordinator', max: 20, idleTimeoutMillis: 30000, connectionTimeoutMillis: 2000, }); // Test the connection pool.on('connect', () => { console.log('✅ Connected to PostgreSQL database'); }); pool.on('error', (err) => { console.error('❌ PostgreSQL connection error:', err); }); export default pool;