Spaces:
Running
Running
| 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(); | |