hapi-pg-promise

2.0.0 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i hapi-pg-promise

Weekly Downloads

7

Version

2.0.0

License

MIT

Unpacked Size

12.1 kB

Total Files

7

Last publish

Collaborators

  • dszczyt