Socket
Socket
Sign inDemoInstall

hapi-knex-postgres

Package Overview
Dependencies
95
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    hapi-knex-postgres

Knex plugin for hapi using postgres


Version published
Weekly downloads
6
increased by100%
Maintainers
1
Install size
6.17 MB
Created
Weekly downloads
 

Readme

Source

hapi-knex-postgres

Hapi.js plugin using Knex supporting for postgres

Install

npm i hapi-knex-postgres

Why

  • I'm using hapi
  • I want to use knex
  • I want to use pooling

Dependcies

  • postgres
  • (knex)[http://knexjs.org/]
  • (generic-pool)[https://github.com/coopernurse/node-pool]

Use

  • Register plugin
  const plugin = {
    register: require('hapi-knex-postgres'),
    options: {
      connection: 'postgres://username:password@localhost/database' or knex connection object,
      attach: 'onPreHandler', // By default will be attach to onPreHandler
      detach: 'tail', // by default, will close the pool connection when request end
      searchPath: 'public', you can overwrite it
      pool: { // checkout generic-pool  },
      debug: boolean, //default false
      acquireConnectionTimeout: 10000
    }
  };

  server.register(plugin, (err) => {
    if (err) {
      console.error('Failed loading "hapi-knex-postgres" plugin');
    }
  });
  • Manifest
    "plugins": {
      "hapi-knex-postgres": {
        "connection": {
          host : '127.0.0.1',
          user : 'your_database_user',
          password : 'your_database_password',
          database : 'myapp_test'
        },
        attach: 'onPreHandler',
        detach: 'tail',
        debug: false
      }
    }
    

Contribute

  • feel free to ping me via email or twitter

Keywords

FAQs

Last updated on 28 Oct 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc