Move db to pg-promise

This commit is contained in:
Tom Russell 2018-09-30 16:17:31 +01:00
parent 8fdcb8defa
commit f8803b7875

View File

@ -8,10 +8,11 @@
* PGPASSWORD=null * PGPASSWORD=null
* PGPORT=5432 * PGPORT=5432
*/ */
import { Pool } from 'pg'; import pg from 'pg-promise';
const pool = new Pool() // pg-promise, can provide initialisation options
const pgp = pg();
// database connection, can provide connection string or object (should default to env vars)
const db = pgp();
const query = (text, params) => pool.query(text, params); export default db;
export { pool, query }