-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdb.js
executable file
·36 lines (34 loc) · 999 Bytes
/
db.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
const config = require('./config');
const { Pool } = require('pg');
const pool = new Pool({
user: config.environment.db.user,
host: config.environment.db.host,
database: config.environment.db.database,
password: config.environment.db.password,
port: config.environment.db.port,
max: 5,
idleTimeoutMillis: 30000,
connectionTimeoutMillis: 5000,
});
module.exports = pool;
// module.exports = {
// /**
// * Get a connection from the pool.
// *
// * @param callback - A callback that takes in an error and a connection.
// */
// getConnection: function (callback) {
// pool.getConnection((err, connection) => callback(err, connection));
// },
//
// /**
// * Release a connection back into the pool.
// *
// * @param connection - The connection to release.
// */
// releaseConnection: function (connection) {
// if (connection) {
// connection.release();
// }
// }
// };