import pg from "pg"; const { Pool } = pg; const pool = new Pool(); try { const result = await pool.query( `SELECT current_database() AS database, current_user AS user_name, $1::text AS app_message`, ["Node.js connected to PostgreSQL"], ); const row = result.rows[0]; console.log(`database=${row.database}`); console.log(`user=${row.user_name}`); console.log(`message=${row.app_message}`); } finally { await pool.end(); }