2.0.0 • Published 6 years ago

hapi-pg-promise v2.0.0

Weekly downloads
21
License
MIT
Repository
github
Last release
6 years ago

hapi-pg-promise

Wrap requests with a Postgres connection using promises.

Build Status Dependency Status devDependency Status peerDependency Status

We use the pg-promise (pg-promise)

Install

$ npm install hapi-pg-promise

Usage

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

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

Hapi 17

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

Register the plugin

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

server.register(plugin);

License

MIT

2.0.0

6 years ago

1.0.0

7 years ago

0.0.6

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago