packages/api-gateway/src/index.js
function findEndpoint(resourcePath, method) {
  return loadEndpoints()
  .then(endpoints => {
    const endpoint = _.find(endpoints, endpoint => { return endpoint.getResourcePath() === resourcePath && endpoint.getMethod() === method; });
    if (!endpoint) {
      return Promise.reject(new Error('Could not find the endpoint "' + method + ' ' + resourcePath + '" in the current project'));
    }
    return endpoint;
  });
}
function findEndpoint(resourcePath, method) {
  return loadEndpoints()
  .then(endpoints => {
    const endpoint = _.find(endpoints, endpoint => { return endpoint.getResourcePath() === resourcePath && endpoint.getMethod() === method; });
    if (!endpoint) {
      return Promise.reject(new Error('Could not find the endpoint "' + method + ' ' + resourcePath + '" in the current project'));
    }
    return endpoint;
  });
}
function findEndpoint ( resourcePath , method ) { return loadEndpoints ( ) . then ( endpoints => { const endpoint = _ . find ( endpoints , endpoint => { return endpoint . getResourcePath ( ) === resourcePath && endpoint . getMethod ( ) === method ; } ) ; if ( ! endpoint ) { return Promise . reject ( new Error ( 'Could not find the endpoint "' + method + ' ' + resourcePath + '" in the current project' ) ) ; } return endpoint ; } ) ; }
Find an endpoint by its resource path and HTTP method
@param {string} resourcePath - the resource path of the endpoint
@param {string} method - the HTTP method of the endpoint
@returns {Endpoint} - the endpoint corresponding to the resource path and the HTTP method
Find an endpoint by its resource path and HTTP method