lib/controller/controller.js
/**
   * Execute specific action in this controller 
   * 
   * @returns {Promise<any>}   resolve with invalid koa response body type(String, Buffer, Object, Stream or null) or an Error.
   */
Execute specific action in this controller

@returns {Promise}   resolve with invalid koa response body type(String, Buffer, Object, Stream or null) or an Error.
Execute specific action in this controller @returns { Promise } resolve with invalid koa response body type ( String Buffer Object Stream or null ) or an Error .
execute() {
    let actionName = this.route.actionName;
    let action = this[actionName];
    let ended = false;
    if (action && typeof action === 'function') {
      if (ut.isGeneratorFunction(action)) {
        action = co.wrap(action);
      }
      if (!ended) {
        let result = action.call(this);
        this.emit('afteraction', this, result);
        return Promise.resolve(result);
      }
    }
    return Promise.reject(new ActionNotFoundError(this.route.controllerName, this.route.actionName));
  }
execute ( ) { let actionName = this . route . actionName ; let action = this [ actionName ] ; let ended = false ; if ( action && typeof action === 'function' ) { if ( ut . isGeneratorFunction ( action ) ) { action = co . wrap ( action ) ; } if ( ! ended ) { let result = action . call ( this ) ; this . emit ( 'afteraction' , this , result ) ; return Promise . resolve ( result ) ; } } return Promise . reject ( new ActionNotFoundError ( this . route . controllerName , this . route . actionName ) ) ; }
Execute specific action in this controller
Execute specific action in this controller