Global

Members

BaseContextClass :Controller

Retreive base context class

Since:
  • 1.0.0
Source:

Controller :Controller

Retreive base controller

Since:
  • 1.0.0
Source:

(constant) loaders

Mixin methods to EggLoader // ES6 Multiple Inheritance https://medium.com/@leocavalcante/es6-multiple-inheritance-73a3c66d2b6b

Source:

Service :Service

Retreive base service

Since:
  • 1.0.0
Source:

startCluster

Start egg application with cluster mode

Since:
  • 1.0.0
Source:

state :Object

alias to Context#locals, compatible with koa that use this variable

Source:
See:

Methods

convertMiddlewares(middlewares, app) → {Array}

  1. ensure controller(last argument) support string
  2. [url, controller]: app.get('/home', 'home');
  3. [name, url, controller(string)]: app.get('posts', '/posts', 'posts.list');
  4. [name, url, controller]: app.get('posts', '/posts', app.controller.posts.list);
  5. [name, url(regexp), controller]: app.get('regRouter', /\/home\/index/, 'home.index');
  6. [name, url, middleware, [...], controller]: app.get(/user/:id', hasLogin, canGetUser, 'user.show');

  7. make middleware support generator function

Parameters:
Name Type Description
middlewares Array

middlewares and controller(last middleware)

app Application

egg application instance

Source:

loadExtend(name, proto)

Loader app/extend/xx.js to prototype,

Parameters:
Name Type Description
name String

filename which may be app/extend/{name}.js

proto Object

prototype that mixed

Since:
  • 1.0.0
Source:

prepareObjectStackTrace()

Capture call site stack from v8. https://github.com/v8/v8/wiki/Stack-Trace-API

Source:

resolveController(controller, app) → {function}

resolve controller from string to function

Parameters:
Name Type Description
controller String | function

input controller

app Application

egg application instance

Source:

spliteAndResolveRouterParams(options) → {Object}

  1. split (name, url, ...middleware, controller) to { prefix: [name, url] middlewares [...middleware, controller] }

  2. resolve controller from string to function

Parameters:
Name Type Description
options Object

inputs

Properties
Name Type Description
args Object

router params

app Object

egg application instance

Source: