- Use
postgresql
withpromise
api, based on pg.
$ npm install pg
$ npm install pg-then
let pg = require('pg-then');
let pool = pg.Pool('postgres://username:password@localhost/database');
pool.query('SELECT ...')
.then(...)
.catch(...);
let pg = require('pg-then');
let client = pg.Client('postgres://username:password@localhost/database');
client.query('SELECT ...')
.then(...)
.catch(...);
// ...
client.end();
MIT