fix: make options more compatibility

This commit is contained in:
dead-horse 2019-08-19 11:54:41 +08:00
parent 1015cea41d
commit 287e589ac7

View file

@ -44,13 +44,14 @@ module.exports = class Application extends Emitter {
* *
*/ */
constructor(options = {}) { constructor(options) {
super(); super();
options = options || {};
this.proxy = options.proxy || false; this.proxy = options.proxy || false;
this.middleware = [];
this.subdomainOffset = options.subdomainOffset || 2; this.subdomainOffset = options.subdomainOffset || 2;
this.env = options.env || process.env.NODE_ENV || 'development'; this.env = options.env || process.env.NODE_ENV || 'development';
this.keys = options.keys || undefined; if (options.keys) this.keys = options.keys;
this.middleware = [];
this.context = Object.create(context); this.context = Object.create(context);
this.request = Object.create(request); this.request = Object.create(request);
this.response = Object.create(response); this.response = Object.create(response);