egg/lib/loader/app_worker_loader.js
Haoliang Gao 350d0f5aaf feat: [BREAKING_CHANGE] use egg-core (#44)
* feat: [BREAKING_CHANGE] use egg-core

* fix: miss app and config to publish

* deps: upgrade egg-rest

* deps: update using autod

* test: use supertest@2

* Release 0.1.0-beta.3

* feat: enable logrotater by default

* chore: add circleci

* refactor: rename logrotater => logrotator

* feat: remove log-reload event

* test: let examples pass test

* fix: remove more close event

* refactor: extract Symbol as a constant

* deps: upgrade egg-core

* Release 0.1.0-beta.4

* fix: use egg when customEgg is not specified
2016-08-18 15:42:20 +08:00

47 lines
885 B
JavaScript

'use strict';
const EggLoader = require('egg-core').EggLoader;
/**
* App Worker process Loader, will load plugins
* @see https://github.com/eggjs/egg-loader
*/
class AppWorkerLoader extends EggLoader {
/**
* loadPlugin first, then loadConfig
* @since 1.0.0
*/
loadConfig() {
super.loadPlugin();
super.loadConfig();
}
/**
* 开始加载所有约定目录
* @since 1.0.0
*/
load() {
// app > plugin > core
this.loadApplicationExtend();
this.loadRequestExtend();
this.loadResponseExtend();
this.loadContextExtend();
this.loadHelperExtend();
// app > plugin
this.loadCustomApp();
// app > plugin
this.loadService();
// app > plugin > core
this.loadMiddleware();
// app
this.loadController();
// app
this.loadRouter(); // 依赖 controller
}
}
module.exports = AppWorkerLoader;