hapi-mysql

1.0.16 • Public • Published

hapi-mysql

Usage

Register plugin:

var server = Hapi.createServer('0.0.0.0', 8000);
server.pack.require('hapi-mysql', Config.db, function(err) {
  if (err) {
    console.error(err);
    throw err;
  }
});

Use plugin:

request.server.plugins['hapi-mysql'].pool.getConnection(function(err, connection) {
 
  // Use the connection
  connection.query(
    'SELECT 1 FROM mytable',
    function(err, rows) {
 
      if(err) {
        throw new Error(err)
      }
    }
  )
 
  // And done with the connection.
  connection.release();
})

Dependencies (1)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i hapi-mysql

    Weekly Downloads

    0

    Version

    1.0.16

    License

    ISC

    Unpacked Size

    1.65 kB

    Total Files

    3

    Last publish

    Collaborators

    • ceejbot
    • mmalecki
    • rockbot
    • seldo