Skip to content

manV/hapi-mysql

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

hapi-mysql

Dead-simple MySQL plugin for Hapi. 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();
})

About

Dead-simple MySQL plugin for Hapi

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 100.0%