Skip to content

Instantly share code, notes, and snippets.

@mhkeller
Created February 26, 2019 22:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mhkeller/d32a7ad78e19739da07858f4f66ac5bc to your computer and use it in GitHub Desktop.
Save mhkeller/d32a7ad78e19739da07858f4f66ac5bc to your computer and use it in GitHub Desktop.
boilerplate connect to database
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