npm

npm’s 2019 JavaScript ecosystem survey analysis is now available!Get your copy here »

hapi-mysql

1.0.15 • 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();
})

install

npm i hapi-mysql

Downloadsweekly downloads

82

version

1.0.15

license

ISC

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
  • avatar
  • avatar
  • avatar
Report a vulnerability