experimental: refactoring for pg pool
This commit is contained in:
11
db/Pool.js
Normal file
11
db/Pool.js
Normal file
@@ -0,0 +1,11 @@
|
||||
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
|
||||
query: (text, params) => pool.query(text, params)
|
||||
}
|
||||
@@ -22,6 +22,7 @@ module.exports = (app) => {
|
||||
store: new (require('connect-pg-simple')(session))({
|
||||
conString: process.env.CONNECTION,
|
||||
createTableIfMissing: true,
|
||||
pruneSessionInterval: 60 * 30
|
||||
})
|
||||
}));
|
||||
}
|
||||
Reference in New Issue
Block a user