A lightweight, zero-dependency wrapper around the `pg` (node-postgres) library for Node.js, providing simplified CRUD methods (`one`, `oneOrNone`, `any`, `many`, `none`) and automatic connection management via a single `POSTGRES_URL` environment variable. Version 1.0.4 is the latest stable release. It is designed for quick prototyping and small projects, with minimal API surface and no ORM features. Key differentiator: instant setup with environment variables, no configuration files required.
npm install postgres-wrapperNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage: importing the module, querying a single row, and closing the connection.
Ensure POSTGRES_URL is defined in .env or process environment before calling any query method.
Always call await pg.end() after finishing all queries, or use a single instance.
Install @types/pg and create a custom type declaration for postgres-wrapper.
Run: npm install pg
Set POSTGRES_URL to a valid PostgreSQL connection string (e.g., postgres://user:pass@localhost:5432/mydb)
Use const pg = require('postgres-wrapper')