packages/api-gateway/src/cli/create-api.js
function executeCommand(parameters) {
    // If a name has been provided, we create the project directory
    const specFilePath = path.join(process.cwd(), plugin.config.apisPath, parameters.apiIdentifier);
    return mkdirpAsync(specFilePath)
    .then(() => {
      const spec = {
        swagger: '2.0',
        info: {
          title: parameters.title,
          description: parameters.desc
        },
        schemes: ['https'],
        host: 'API_ID.execute-api.REGION.amazonaws.com',
        consume: parameters.consume,
        produce: parameters.produce,
        paths: {},
        definitions: {}
      };
      return fs.writeFileAsync(specFilePath + path.sep + 'spec.json', JSON.stringify(spec, null, 2));
    })
    .then(() => {
      const msg = '\n  The API "' + icli.format.info(parameters.apiIdentifier) + '" has been created\n\n'
              + '  Its Swagger specification is available in ' + icli.format.info(specFilePath + path.sep + 'spec.json') + '\n'
              + '  You can inspect it using the command ' + icli.format.cmd('myrmex inspect-api ' + parameters.apiIdentifier) + '\n';
      icli.print(msg);
    });
  }
function executeCommand(parameters) {
    // If a name has been provided, we create the project directory
    const specFilePath = path.join(process.cwd(), plugin.config.apisPath, parameters.apiIdentifier);
    return mkdirpAsync(specFilePath)
    .then(() => {
      const spec = {
        swagger: '2.0',
        info: {
          title: parameters.title,
          description: parameters.desc
        },
        schemes: ['https'],
        host: 'API_ID.execute-api.REGION.amazonaws.com',
        consume: parameters.consume,
        produce: parameters.produce,
        paths: {},
        definitions: {}
      };
      return fs.writeFileAsync(specFilePath + path.sep + 'spec.json', JSON.stringify(spec, null, 2));
    })
    .then(() => {
      const msg = '\n  The API "' + icli.format.info(parameters.apiIdentifier) + '" has been created\n\n'
              + '  Its Swagger specification is available in ' + icli.format.info(specFilePath + path.sep + 'spec.json') + '\n'
              + '  You can inspect it using the command ' + icli.format.cmd('myrmex inspect-api ' + parameters.apiIdentifier) + '\n';
      icli.print(msg);
    });
  }
function executeCommand ( parameters ) { // If a name has been provided, we create the project directory const specFilePath = path . join ( process . cwd ( ) , plugin . config . apisPath , parameters . apiIdentifier ) ; return mkdirpAsync ( specFilePath ) . then ( ( ) => { const spec = { swagger : '2.0' , info : { title : parameters . title , description : parameters . desc } , schemes : [ 'https' ] , host : 'API_ID.execute-api.REGION.amazonaws.com' , consume : parameters . consume , produce : parameters . produce , paths : { } , definitions : { } } ; return fs . writeFileAsync ( specFilePath + path . sep + 'spec.json' , JSON . stringify ( spec , null , 2 ) ) ; } ) . then ( ( ) => { const msg = '\n  The API "' + icli . format . info ( parameters . apiIdentifier ) + '" has been created\n\n' + '  Its Swagger specification is available in ' + icli . format . info ( specFilePath + path . sep + 'spec.json' ) + '\n' + '  You can inspect it using the command ' + icli . format . cmd ( 'myrmex inspect-api ' + parameters . apiIdentifier ) + '\n' ; icli . print ( msg ) ; } ) ; }
Create the new api
@param {Object} parameters - the parameters provided in the command and in the prompt
@returns {Promise<null>} - The execution stops here
Create the new api