Created
February 26, 2019 22:16
-
-
Save mhkeller/d32a7ad78e19739da07858f4f66ac5bc to your computer and use it in GitHub Desktop.
boilerplate connect to database
This file contains 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 { Pool } = require('pg'); | |
const connectionString = require('./connection-string.json'); | |
const pool = new Pool(connectionString); | |
async function main () { | |
const x = await pool.query('Select count(*) from my_table'); | |
console.log(x.rows); | |
} | |
main(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment