app/App.js
/**
   *  Binds a route onto the express instance
   *
   *  @param {object} route The route object to bind
   *  @return {void}
   */
Binds a route onto the express instance
@param {object} route The route object to bind
@return {void}
Binds a route onto the express instance @param { object } route The route object to bind @return { void }
bindRoute(route) {
    this.routes.push(route);
    this.getApp().all(route.path, (req, res, next) => {
      this.validateRequestMethod(req, route, this.routes);
      if(req.method.toUpperCase() !== route.httpMethod.toUpperCase()) {
        next();
        return;
      }
      let controllerClass = require(this.getService('Environment.js').getControllerDir() + route.controller.path),
          controller = new controllerClass();
      controller.setServiceContainer(this.getServiceContainer());
      controller.setRequest(req).setResponse(res);
      controller.setCurrentRoute(clone(route));
      controller.setRoutes(clone(this.routes));
      try {
        const validation = new ResourceValidation();
        validation.validateRequest(req, clone(route));
        controller[route.controller.method]().then(() => {
          next();
        }, (err) => {
          next(err);
        }).catch((err) => {
          next(err);
        });
      } catch(err) {
        next(err);
      }
    });
  }
bindRoute ( route ) { this . routes . push ( route ) ; this . getApp ( ) . all ( route . path , ( req , res , next ) => { this . validateRequestMethod ( req , route , this . routes ) ; if ( req . method . toUpperCase ( ) !== route . httpMethod . toUpperCase ( ) ) { next ( ) ; return ; } let controllerClass = require ( this . getService ( 'Environment.js' ) . getControllerDir ( ) + route . controller . path ) , controller = new controllerClass ( ) ; controller . setServiceContainer ( this . getServiceContainer ( ) ) ; controller . setRequest ( req ) . setResponse ( res ) ; controller . setCurrentRoute ( clone ( route ) ) ; controller . setRoutes ( clone ( this . routes ) ) ; try { const validation = new ResourceValidation ( ) ; validation . validateRequest ( req , clone ( route ) ) ; controller [ route . controller . method ] ( ) . then ( ( ) => { next ( ) ; } , ( err ) => { next ( err ) ; } ) . catch ( ( err ) => { next ( err ) ; } ) ; } catch ( err ) { next ( err ) ; } } ) ; }
Binds a route onto the express instance
  @param {object} route The route object to bind
  @return {void}
Binds a route onto the express instance @param { object } route The route object to bind @return { void }