agep-cargo/backend/db.js
2025-10-11 03:21:04 +02:00

19 lines
391 B
JavaScript

import dotenv from 'dotenv'
import pkg from 'pg'
const { Pool } = pkg
dotenv.config()
const pool = new Pool({
connectionString: process.env.DATABASE_URL,
// Optional SSL setting for hosted DBs (uncomment when needed)
// ssl: { rejectUnauthorized: false }
})
pool.on('error', (err) => {
console.error('Unexpected error on idle client', err)
process.exit(-1)
})
export { pool }