app_worker_loader.js 925 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. 'use strict';
  2. const EggLoader = require('egg-core').EggLoader;
  3. /**
  4. * App worker process Loader, will load plugins
  5. * @see https://github.com/eggjs/egg-loader
  6. */
  7. class AppWorkerLoader extends EggLoader {
  8. /**
  9. * loadPlugin first, then loadConfig
  10. * @since 1.0.0
  11. */
  12. loadConfig() {
  13. this.loadPlugin();
  14. super.loadConfig();
  15. }
  16. /**
  17. * Load all directories in convention
  18. * @since 1.0.0
  19. */
  20. load() {
  21. // app > plugin > core
  22. this.loadApplicationExtend();
  23. this.loadRequestExtend();
  24. this.loadResponseExtend();
  25. this.loadContextExtend();
  26. this.loadHelperExtend();
  27. this.loadCustomLoader();
  28. // app > plugin
  29. this.loadCustomApp();
  30. // app > plugin
  31. this.loadService();
  32. // app > plugin > core
  33. this.loadMiddleware();
  34. // app
  35. this.loadController();
  36. // app
  37. this.loadRouter(); // Dependent on controllers
  38. }
  39. }
  40. module.exports = AppWorkerLoader;