Skip to content

Commit

Permalink
Added Database.close() and Database.disconnect() methods to allow gra…
Browse files Browse the repository at this point in the history
…ceful closing of DB connections
  • Loading branch information
notheotherben committed Jan 10, 2014
1 parent 9915b47 commit a8ec072
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/Database.js
Expand Up @@ -58,6 +58,12 @@ Database.prototype.connect = function (cb) {
});
};

Database.prototype.close = Database.prototype.disconnect = function() {
if(!this.connection) return;
this.connection.close();
this.connection = null;
};

Database.prototype.express = function() {
/// <summary>Creates an Express Middleware which will make this database wrapper available through the req.db property</summary>
/// <returns type="Function"/>
Expand Down

0 comments on commit a8ec072

Please sign in to comment.