Make app.get/app.set available in browser
Implement settings object and methods in browser-express.
This commit is contained in:
parent
ee1dfc8e4f
commit
4259a3862a
|
@ -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];
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue