Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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;
}
}