1.0.4 • Published 4 years ago

hapi-pg-promise-multi v1.0.4

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

hapi-pg-promise-multi

Wrap requests with a Postgres connection using promises.

Build Status dependencies Status devDependencies Status peerDependencies Status

We use the pg-promise (pg-promise)

Install

$ npm install hapi-pg-promise-multi

Usage

In your request handlers you'll have access to request.BASE_NAME which you can use to make DB requests.

server.plugins['hapi-pg-promise'].BASE_NAME is available outside of request handlers.

Hapi 18

Current version works with Hapi 18.x.x. For older versions use 1.0.0 of hapi-pg-promise.

Register the plugin

const hapiPgPromise = require('hapi-pg-promise-multi');
const plugin = {
    plugin: hapiPgPromise,
    options: [{
        cn: 'postgres://username:password@host:port/database',
        name: 'BASE_NAME',
        settings: {
            // pg-promise options
        }
    },{
        cn: 'postgres://username:password@host:port/database_next',
        name: 'BASE_NAME_NEXT',
        settings: {
            // pg-promise options
        }
    }]
};

server.register(plugin);

Original

dszczyt/hapi-pg-promise

License

MIT

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.0.1

4 years ago