Skip to content

Commit f7708cc

Browse files
committed
Refactor DIRS to explicit code
PR-URL: #156
1 parent 9300052 commit f7708cc

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

lib/application.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ const security = require('./security.js');
66

77
const SCRIPT_OPTIONS = { timeout: 5000 };
88
const EMPTY_CONTEXT = Object.freeze({});
9-
const DIRS = ['static', 'domain', 'api'];
109

1110
class Application extends events.EventEmitter {
1211
constructor() {
@@ -15,14 +14,16 @@ class Application extends events.EventEmitter {
1514
this.namespaces = ['db'];
1615
this.path = process.cwd();
1716
this.staticPath = path.join(this.path, 'static');
17+
this.api = new Map();
18+
this.domain = new Map();
19+
this.static = new Map();
1820
}
1921

2022
async init() {
2123
this.createSandbox();
22-
for (const name of DIRS) {
23-
this[name] = new Map();
24-
await this.loadPlace(name, path.join(this.path, name));
25-
}
24+
await this.loadPlace('api', path.join(this.path, 'api'));
25+
await this.loadPlace('domain', path.join(this.path, 'domain'));
26+
await this.loadPlace('static', path.join(this.path, 'static'));
2627
}
2728

2829
async shutdown() {

0 commit comments

Comments
 (0)