colouring-montreal/apiserver/db.js
2018-08-01 18:41:50 +01:00

18 lines
398 B
JavaScript

/**
* Expose query interface to database pool
*
* - connection details must be set in environment variables, default to:
* PGHOST='localhost'
* PGUSER=process.env.USER
* PGDATABASE=process.env.USER
* PGPASSWORD=null
* PGPORT=5432
*/
const { Pool } = require('pg')
const pool = new Pool()
module.exports = {
query: (text, params) => pool.query(text, params)
}