Skip to content

Commit

Permalink
Revert Express middleware, v1.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
notheotherben committed Nov 27, 2013
1 parent 987abb8 commit 68226ba
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
28 changes: 16 additions & 12 deletions lib/Database.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,25 @@ Database.prototype.connect = function (cb) {
});
};

Database.prototype.express = function(req, res, next) {
/// <summary>Express Middleware which will make this database wrapper available through the req.db property</summary>
/// <param name="req" type="Object">Node Request object</param>
/// <param name="res" type="Object">Node Response object</param>
/// <param name="next" type="Function">Callback used to continue to the next step in the Express request pipeline</param>
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"/>

"use strict";

var $ = this;

$.connect(function (err, _db) {
if (err) return next(err);
req.db = _db;
return next();
});

return function(req, res, next) {
/// <summary>Express Middleware which will make this database wrapper available through the req.db property</summary>
/// <param name="req" type="Object">Node Request object</param>
/// <param name="res" type="Object">Node Response object</param>
/// <param name="next" type="Function">Callback used to continue to the next step in the Express request pipeline</param>

$.connect(function (err, _db) {
if (err) return next(err);
req.db = _db;
return next();
});
};
};

Database.prototype.register = function (name, model) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "iridium",
"version": "1.3.0",
"version": "1.3.1",
"author": "Benjamin Pannell <[email protected]>",
"description": "A custom lightweight ORM for MongoDB designed for power-users",
"homepage": "https://sierrasoftworks.com/iridium",
Expand Down

0 comments on commit 68226ba

Please sign in to comment.