How to use the @aws-cdk/aws-apigateway.LambdaRestApi function in @aws-cdk/aws-apigateway

To help you get started, we’ve selected a few @aws-cdk/aws-apigateway examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aws-samples / aws-cdk-changelogs-demo / changelogs-md.js View on Github external
super(parent, id, props);

    // Create a lambda that returns autocomplete results
    const autocomplete = new lambda.Function(this, 'autocomplete', {
      runtime: lambda.Runtime.NODEJS_10_X,
      handler: 'autocomplete.handle',
      code: lambda.Code.asset('./app/autocomplete'),
      environment: {
        SEARCH_INDEX_TABLE_NAME: props.searchIndexTable.tableName
      }
    });

    // Grant the lambda permission to modify the tables
    props.searchIndexTable.grantReadWriteData(autocomplete.role);

    this.autocompleteGateway = new apiGateway.LambdaRestApi(this, 'autocomplete-gateway', {
      handler: autocomplete,
      proxy: true
    });

    this.url = this.autocompleteGateway.url;
  }
}