runsv-pg
v2.0.3
Published
runsv pg service
Readme
runsv PostgreSQL service
This is a service wrapper around the excellent node-postgres for runsv.
Install
If you have already installed pg
$ npm install runsv-pgOtherwise
$ npm install pg runsv-pgpg is a peer dependency of this module
Usage
const runsv = require('runsv')();
const pg = require('runsv-pg')();
runsv.addService(pg);
runsv.start(function(err, {pg}){
pg.query('SELECT $1::text as message;', ['hello'], function(err, res){
//your program goes here
});
});Configure node-postgres
You can configure your connection to PostgreSQL the same way you you do it with node-postgres. You can use the environment variables or pass your configuration options.
// Passing config options
const pgConfig = {
...
};
const pg = require('runsv-pg')(pgConfig);