Created
January 2, 2019 03:37
-
-
Save rcdexta/42b577385113334c952a5cebdc8971ef to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { Client } = require('pg') | |
const pg = { | |
init: async function() { | |
const client = new Client({ | |
user: process.env['DB_USER'] || 'postgres', | |
host: process.env['DB_HOST'] || 'localhost', | |
database: process.env['DB_NAME'] || 'customers', | |
password: process.env['DB_PASSWORD'] || '', | |
port: 5432 | |
}) | |
await client.connect(); | |
return client; | |
} | |
} | |
module.exports = pg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment