diff --git a/bower.json b/bower.json index 9440434..5c8b753 100644 --- a/bower.json +++ b/bower.json @@ -2,7 +2,7 @@ "name": "page.js-express-mapper.js", "description": "Plugin for page.js which directly imitates the Express API.", "author": "Eric Newport ", - "version": "1.0.2", + "version": "1.0.3", "homepage": "https://github.com/kethinov/page.js-express-mapper.js", "license": "Creative Commons Attribution 4.0 International License", "main": "page.js-express-mapper.js", @@ -10,6 +10,9 @@ "type": "git", "url": "git://github.com/kethinov/page.js-express-mapper.js.git" }, + "dependencies": { + "page": "^1.5.0" + }, "keywords": [ "page.js", "express", diff --git a/package.json b/package.json index 4008e0a..d940417 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "page.js-express-mapper.js", - "version": "1.0.2", + "version": "1.0.3", "description": "Plugin for page.js which directly imitates the Express API.", "main": "page.js-express-mapper.js", "repository": { @@ -15,7 +15,7 @@ "homepage": "https://github.com/kethinov/page.js-express-mapper.js", "readmeFilename": "README.md", "dependencies": { - "page": "^1.4.0" + "page": "^1.5.0" }, "keywords": [ "page.js", diff --git a/page.js-express-mapper.js b/page.js-express-mapper.js index c960a36..9195cc9 100644 --- a/page.js-express-mapper.js +++ b/page.js-express-mapper.js @@ -1,8 +1,7 @@ ;(function() { function pageExpressMapper(params) { - var app, - res; + var app, res; // renderMethod param if (params.renderMethod && typeof params.renderMethod == 'function') { @@ -10,7 +9,7 @@ res = { render: params.renderMethod, // template, model redirect: function(route) { - page(route); + page.redirect(route); } }; @@ -18,7 +17,7 @@ page.Route.prototype.middleware = function(fn) { var self = this; return function(ctx, next) { - if (self.match(ctx.path, ctx.params)) return fn(ctx, res, next); + if (self.match(ctx.path, ctx.params)) return fn(ctx, res, next); // new next(); }; }; @@ -55,7 +54,11 @@ } } - if ('undefined' != typeof window) { + // expose pageExpressMapper + if ('undefined' == typeof module) { window.pageExpressMapper = pageExpressMapper; } + else { + module.exports = pageExpressMapper; + } })(); \ No newline at end of file