Files
e-commerce/db/Pool.js
2022-07-05 11:31:35 -05:00

11 lines
375 B
JavaScript

const { Pool } = require('pg');
require('dotenv').config({ path: './config.env' });
const pool = new Pool({ connectionString: process.env.CONNECTION });
module.exports = {
// text = SQL query; params = array of values to inject
connect: async () => await pool.connect(),
query: (text, params) => pool.query(text, params),
end: async () => await pool.end()
}