runsv-pg
v1.0.0
Published
runsv pg service
Downloads
255
Readme
runsv PostgreSQL service
This is a service wrapper around the excellent node-postgres for runsv.
Install
$ npm install runsv-pg
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);