in src/table-viewer.ts [45:68]
constructor(parent: Construct, id: string, props: TableViewerProps) {
super(parent, id);
const handler = new lambda.Function(this, 'Rendered', {
code: lambda.Code.fromAsset(path.join(__dirname, '..', 'lambda')),
runtime: lambda.Runtime.NODEJS_12_X,
handler: 'index.handler',
environment: {
TABLE_NAME: props.table.tableName,
TITLE: props.title || '',
SORT_BY: props.sortBy || '',
},
});
props.table.grantReadData(handler);
const home = new apigw.LambdaRestApi(this, 'ViewerEndpoint', {
handler,
endpointConfiguration: props.endpointType
? { types: [props.endpointType] }
: undefined,
});
this.endpoint = home.url;
}