From 55669dbc8e739042af256f097058b35a282ad7ba Mon Sep 17 00:00:00 2001 From: Timur Shemsedinov Date: Tue, 14 Jul 2020 21:20:01 +0300 Subject: [PATCH] Refactor DIRS to explicit code --- lib/application.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/application.js b/lib/application.js index cad0be9..54ee1fd 100644 --- a/lib/application.js +++ b/lib/application.js @@ -6,7 +6,6 @@ const security = require('./security.js'); const SCRIPT_OPTIONS = { timeout: 5000 }; const EMPTY_CONTEXT = Object.freeze({}); -const DIRS = ['static', 'domain', 'api']; class Application extends events.EventEmitter { constructor() { @@ -15,14 +14,16 @@ class Application extends events.EventEmitter { this.namespaces = ['db']; this.path = process.cwd(); this.staticPath = path.join(this.path, 'static'); + this.api = new Map(); + this.domain = new Map(); + this.static = new Map(); } async init() { this.createSandbox(); - for (const name of DIRS) { - this[name] = new Map(); - await this.loadPlace(name, path.join(this.path, name)); - } + await this.loadPlace('api', path.join(this.path, 'api')); + await this.loadPlace('domain', path.join(this.path, 'domain')); + await this.loadPlace('static', path.join(this.path, 'static')); } async shutdown() {