Created
September 4, 2013 03:06
-
-
Save villadora/6432356 to your computer and use it in GitHub Desktop.
usage for node-mysql-pool
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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