Adding postgres example

This commit is contained in:
Chris Patterson
2019-08-15 09:23:28 -04:00
parent 3ac9cff9f2
commit efa6307ac2
5 changed files with 297 additions and 0 deletions

17
postgres/client.js Normal file
View File

@@ -0,0 +1,17 @@
const { Client } = require('pg')
const pgclient = new Client({
host: 'postgres',
port: 5432,
user: 'postgres',
password: 'postgres',
database: 'postgres'
});
pgclient.connect();
pgclient.query('SELECT NOW()', (err, res) => {
if (err) throw err
console.log(res)
pgclient.end()
});