diff --git a/lib/Database.js b/lib/Database.js
index fd81286..ff07fbd 100644
--- a/lib/Database.js
+++ b/lib/Database.js
@@ -54,21 +54,25 @@ Database.prototype.connect = function (cb) {
});
};
-Database.prototype.express = function(req, res, next) {
- /// Express Middleware which will make this database wrapper available through the req.db property
- /// Node Request object
- /// Node Response object
- /// Callback used to continue to the next step in the Express request pipeline
+Database.prototype.express = function() {
+ /// Creates an Express Middleware which will make this database wrapper available through the req.db property
+ ///
"use strict";
-
var $ = this;
-
- $.connect(function (err, _db) {
- if (err) return next(err);
- req.db = _db;
- return next();
- });
+
+ return function(req, res, next) {
+ /// Express Middleware which will make this database wrapper available through the req.db property
+ /// Node Request object
+ /// Node Response object
+ /// Callback used to continue to the next step in the Express request pipeline
+
+ $.connect(function (err, _db) {
+ if (err) return next(err);
+ req.db = _db;
+ return next();
+ });
+ };
};
Database.prototype.register = function (name, model) {
diff --git a/package.json b/package.json
index ffafe20..b2f4128 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "iridium",
- "version": "1.3.0",
+ "version": "1.3.1",
"author": "Benjamin Pannell ",
"description": "A custom lightweight ORM for MongoDB designed for power-users",
"homepage": "https://sierrasoftworks.com/iridium",