diff --git a/lib/db.js b/lib/db.js index 43bc5bb..86c1daf 100644 --- a/lib/db.js +++ b/lib/db.js @@ -3,14 +3,15 @@ var mysql = require('mysql'); var config = require('./config'); exports.connect = function(done) { - var db = mysql.createConnection(config.mysql); - db.connect(); + var pool = mysql.createPool(Object.assign({ + connectionLimit : 2, + }, config.mysql)); - require('./migrations').doMigrations(db, function(err) { + require('./migrations').doMigrations(pool, function(err) { if (err) { done(err); } else { - done(null, db); + done(null, pool); } }); };