application.js
function runHooks(request, response, hooks) {
    var promise = Promise.resolve();
    for (var i = 0; i < hooks.length; i++) {
      promise = promise.then(hooks[i].bind(this, request, response));
    }
    return promise;
  }
function runHooks(request, response, hooks) {
    var promise = Promise.resolve();
    for (var i = 0; i < hooks.length; i++) {
      promise = promise.then(hooks[i].bind(this, request, response));
    }
    return promise;
  }
function runHooks ( request , response , hooks ) { var promise = Promise . resolve ( ) ; for ( var i = 0 ; i < hooks . length ; i ++ ) { promise = promise . then ( hooks [ i ] . bind ( this , request , response ) ) ; } return promise ; }
Run given hooks
@param request
@param response
@param hooks
@returns {Promise}
Run given hooks