Query Templates for Postgres in Node.js. A lightweight library (v1.1.1, stable) for creating parameterized SQL query templates, reducing boilerplate and improving security by separating query structure from data. Active development with a MIT license; minimal dependencies but requires Node.js and a PostgreSQL client like 'pg'. Differentiates with simple template syntax and explicit query parameterization.
npm install pg-query-templateNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a QueryTemplate, connects to PostgreSQL using pg Pool, executes parameterized query, and logs results.
Use import or require('pg-query-template').defaultAlways use parameterized queries; never concatenate user input into template string.
Call pool.connect() to get a client, then pass client to execute()
const QueryTemplate = require('pg-query-template').default;Get a new client from pool for each query execution.
Use import syntax: import QueryTemplate from 'pg-query-template';