Merge pull request #322 from strongloop/feature/backport-app-settings-in-browser

Make app.get/app.set available in browser
This commit is contained in:
Miroslav Bajtoš 2014-06-12 10:40:49 +02:00
commit b5f0057ea4
1 changed files with 19 additions and 1 deletions

View File

@ -1,7 +1,25 @@
module.exports = browserExpress;
function browserExpress() {
return {};
return new BrowserExpress();
}
browserExpress.errorHandler = {};
function BrowserExpress() {
this.settings = {};
}
BrowserExpress.prototype.set = function(key, value) {
if (arguments.length == 1) {
return this.get(key);
}
this.settings[key] = value;
return this; // fluent API
};
BrowserExpress.prototype.get = function(key) {
return this.settings[key];
};