How to use the egg-core.EggLoader function in egg-core

To help you get started, we’ve selected a few egg-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github eggjs / egg-core / test / fixtures / egg / index.js View on Github external
'use strict';

const fs = require('fs');
const path = require('path');
const rimraf = require('mz-modules/rimraf');

const eggPath = path.join(__dirname, 'node_modules/egg-core');
rimraf.sync(eggPath);
fs.symlinkSync(
  path.join(__dirname, '../../..'),
  eggPath,
  'dir'
);

const EggCore = require('egg-core').EggCore;
const EggLoader = require('egg-core').EggLoader;

class AppLoader extends EggLoader {
  loadAll() {
    this.loadPlugin();
    this.loadConfig();
    this.loadApplicationExtend();
    this.loadContextExtend();
    this.loadRequestExtend();
    this.loadResponseExtend();
    this.loadBootHook();
    this.loadCustomApp();
    this.loadMiddleware();
    this.loadService();
    this.loadController();
    this.loadRouter();
  }
github eggjs / egg-core / test / fixtures / egg / index.js View on Github external
'use strict';

const fs = require('fs');
const path = require('path');
const rimraf = require('mz-modules/rimraf');

const eggPath = path.join(__dirname, 'node_modules/egg-core');
rimraf.sync(eggPath);
fs.symlinkSync(
  path.join(__dirname, '../../..'),
  eggPath,
  'dir'
);

const EggCore = require('egg-core').EggCore;
const EggLoader = require('egg-core').EggLoader;

class AppLoader extends EggLoader {
  loadAll() {
    this.loadPlugin();
    this.loadConfig();
    this.loadApplicationExtend();
    this.loadContextExtend();
    this.loadRequestExtend();
    this.loadResponseExtend();
    this.loadCustomApp();
    this.loadMiddleware();
    this.loadService();
    this.loadController();
    this.loadRouter();
  }
}
github eggjs / egg / lib / loader / agent_worker_loader.js View on Github external
'use strict';

const EggLoader = require('egg-core').EggLoader;

/**
 * Agent worker process loader
 * @see https://github.com/eggjs/egg-loader
 */
class AgentWorkerLoader extends EggLoader {

  /**
   * loadPlugin first, then loadConfig
   */
  loadConfig() {
    this.loadPlugin();
    super.loadConfig();
  }

  load() {
github eggjs / egg / lib / loader / app_worker_loader.js View on Github external
'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() {
    this.loadPlugin();
    super.loadConfig();
  }
github eggjs / egg / lib / loader / agent_worker_loader.js View on Github external
'use strict';

const EggLoader = require('egg-core').EggLoader;

/**
 * Agent worker process loader
 * @see https://github.com/eggjs/egg-loader
 */
class AgentWorkerLoader extends EggLoader {

  /**
   * loadPlugin first, then loadConfig
   */
  loadConfig() {
    this.loadPlugin();
    super.loadConfig();
  }

  load() {
github midwayjs / midway / packages / midway-web / src / loader / webLoader.ts View on Github external
RouterOption,
  WEB_ROUTER_KEY,
  WEB_ROUTER_PARAM_KEY,
  RouterParamValue,
} from '@midwayjs/decorator';
import * as extend from 'extend2';
import * as fs from 'fs';
import { getClassMetadata, getPropertyDataFromClass, getProviderId, listModule } from 'injection';
import { ContainerLoader, MidwayHandlerKey, MidwayContainer } from 'midway-core';
import * as path from 'path';
import { Middleware, MiddlewareParamArray, MidwayLoaderOptions, WebMiddleware } from '../interface';
import { isTypeScriptEnvironment, safelyGet } from '../utils';
import { EggAppInfo } from 'egg';

const debug = require('debug')(`midway:loader:${process.pid}`);
const EggLoader = require('egg-core').EggLoader;

const TS_SRC_DIR = 'src';
const TS_TARGET_DIR = 'dist';

export class MidwayWebLoader extends EggLoader {
  public baseDir: string;
  public appDir: string;
  public appInfo: EggAppInfo;
  private controllerIds: string[] = [];
  private prioritySortRouters: Array<{
    priority: number,
    router: Router,
  }> = [];
  private containerLoader: ContainerLoader;

  constructor(options: MidwayLoaderOptions) {
github eggjs / egg / lib / loader / app_worker_loader.js View on Github external
'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() {
    this.loadPlugin();
    super.loadConfig();
  }
github eggjs / egg / lib / loader / index.js View on Github external
'use strict';

exports.EggLoader = require('egg-core').EggLoader;
exports.AppWorkerLoader = require('./app_worker_loader');
exports.AgentWorkerLoader = require('./agent_worker_loader');

egg-core

A core Pluggable framework based on koa

MIT
Latest version published 1 year ago

Package Health Score

67 / 100
Full package analysis