Lightweight Database Handler for PostgreSQL built on top of node-postgres (pg) and bluebird promises. Provides a thin wrapper around pg's connection pool with promise-based methods for common database operations, transactions, and query shorthands. Current version 3.0.0. The library simplifies common tasks like transactions and connection lifecycle management using bluebird's Promise.using pattern. Compared to raw pg, it reduces boilerplate for queries and transactions but adds a dependency on bluebird. Suitable for projects already using bluebird or wanting a minimal promise-based interface over pg.
npm install dbh-pgNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic connection usage with fetchOne and a transaction using begin/commit.
Install bluebird: npm install bluebird and require it.
Always call .commit() after successful transaction, or handle rollback explicitly.
Use bluebird promises or async/await with bluebird's Promise.promisifyAll.
Use conn.exec and conn.commit directly.
Run `npm install dbh-pg` and ensure node_modules contains it.
Install bluebird and use `const Promise = require('bluebird');` before using `Promise.using`.Verify PostgreSQL is running and connection string is correct (postgres://user:pass@host/db).
Wrap db.conn() inside `Promise.using(db.conn(), function(conn) { ... });`.