Adding postgres example
This commit is contained in:
17
postgres/client.js
Normal file
17
postgres/client.js
Normal 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()
|
||||
});
|
||||
Reference in New Issue
Block a user