0.0.4 • Published 7 years ago

hapi-knex2 v0.0.4

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

hapi-knex2

Knex plugin for hapi.

Install

$ npm install knex hapi-knex2

Usage

For knex to work install one of the database drivers found in the knex documentation. Then you can do as follows:

const Hapi = require('hapi');

const server = new Hapi.Server(/* options */);

// some other stuff ...

server.register({
  register: require('hapi-knex2'),
  options: {
    knex: {
      client: 'mysql',
      connection: {
        host : '127.0.0.1',
        user : 'your_database_user',
        password : 'your_database_password',
        database : 'myapp_test'
      },
    },
  },
}, err => {
  if (err) throw err;

  server.start();
});

License

MIT