Первый коммит после распаковки архива
This commit is contained in:
22
db.js
Normal file
22
db.js
Normal file
@@ -0,0 +1,22 @@
|
||||
// db.js
|
||||
require('dotenv').config();
|
||||
const { Pool } = require('pg');
|
||||
|
||||
const pool = new Pool({
|
||||
connectionString: process.env.DATABASE_URL,
|
||||
ssl: false
|
||||
});
|
||||
|
||||
module.exports = {
|
||||
/**
|
||||
* Execute a SQL query using the shared connection pool.
|
||||
* @param {string} text
|
||||
* @param {any[]} [params]
|
||||
*/
|
||||
query: (text, params) => pool.query(text, params),
|
||||
|
||||
/**
|
||||
* Expose the underlying pool for transactions or advanced usages.
|
||||
*/
|
||||
pool
|
||||
};
|
||||
Reference in New Issue
Block a user