0.0.10 • Published 10 years ago

hapi-myconnection v0.0.10

Weekly downloads
2
License
MIT
Repository
github
Last release
10 years ago

hapi-myconnection

Wrap Hapi requests with access to a Mysql connection from pool.

It gives you access to request.connection within your handlers which you can then use to make Mysql requests. It also releases the connection to the pool after the request.

Usage

// options used to pass mysql driver to create pool
var mysqlOptions = {
  host: 'localhost',
  user: 'anyUser'
};

server.pack.register({
  plugin: require('hapi-myconnection'),
  options: {
    mysql: mysql,
    mysqlOptions: {
      host: 'localhost',
      user: 'root',
      password: 'root'
    }
  }
}, function(err) {
  throw err;
});

License

MIT