Skip to content

Instantly share code, notes, and snippets.

@villadora
Created September 4, 2013 03:06
Show Gist options
  • Save villadora/6432356 to your computer and use it in GitHub Desktop.
Save villadora/6432356 to your computer and use it in GitHub Desktop.
usage for node-mysql-pool
var pool = mysql.createPool({
host: '127.0.0.1',
port: '3306',
user: 'root',
password: '123456',
database: 'test',
debug: process.env.NODE_ENV == 'debug'
});
module.exports = {
query: function(sql, callback) {
pool.getConnection(function(err, connection) {
connection.query(sql, function(err, rows) {
callback(err, rows);
connection.release();
});
});
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment