Skip to content

Commit

Permalink
pg cloud
Browse files Browse the repository at this point in the history
  • Loading branch information
hnasr committed Jul 6, 2020
1 parent 9bea69b commit 20d4bc4
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions nodepg/query.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const pg = require('pg')
const ClientClass = pg.Client
const pgUrl = "";
const client = new ClientClass(pgUrl)

async function connect(client) {
try {
await client.connect()
console.log(`Client connected.`)

const {rows} = await client.query('SELECT * FROM EMPLOYEES')
console.table(rows)
await client.end()
}
catch(ex){
console.log("Some error" + ex)
}
finally {
await client.end()
}
}

connect(client)





0 comments on commit 20d4bc4

Please sign in to comment.