File size: 510 Bytes
9eab1a6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
const pool = require('./config');

async function testConnection() {
    try {
        const client = await pool.connect();
        console.log('โœ… Successfully connected to the database!');

        const res = await client.query('SELECT VERSION()');
        console.log('๐Ÿ“Š Database Version:', res.rows[0].version);

        client.release();
    } catch (err) {
        console.error('โŒ Connection failed:', err);
    } finally {
        await pool.end();
    }
}

testConnection();