packages/api-gateway/src/index.js
function findModel(name) {
  return loadModels()
  .then(models => {
    const model = _.find(models, model => { return model.getName('spec') === name; });
    if (!model) {
      return Promise.reject(new Error('Could not find the model "' + name + '" in the current project'));
    }
    return model;
  });
}
function findModel(name) {
  return loadModels()
  .then(models => {
    const model = _.find(models, model => { return model.getName('spec') === name; });
    if (!model) {
      return Promise.reject(new Error('Could not find the model "' + name + '" in the current project'));
    }
    return model;
  });
}
function findModel ( name ) { return loadModels ( ) . then ( models => { const model = _ . find ( models , model => { return model . getName ( 'spec' ) === name ; } ) ; if ( ! model ) { return Promise . reject ( new Error ( 'Could not find the model "' + name + '" in the current project' ) ) ; } return model ; } ) ; }
Find an model by its name
@param {string} name - the name of the model
@returns {Model} - the model corresponding to the resource path and the HTTP method
Find an model by its name