mjendza / aws-sandbox

This is my AWS Serverless stack. Build with CDK, NodeJS Lambda, DynamoDB storage.
Apache License 2.0
6 stars 1 forks source link

appsync API with direct dynamoDB resolver #42

Closed mjendza closed 3 years ago

mjendza commented 3 years ago
dynamodbDataSource.createResolver({
        typeName: 'Query',
        fieldName: 'getById',
        requestMappingTemplate: MappingTemplate.dynamoDbGetItem('id', 'id'),
        responseMappingTemplate: MappingTemplate.dynamoDbResultItem(),
    });

dynamodbDataSource.createResolver({
        typeName: 'Query',
        fieldName: 'list',
        requestMappingTemplate: MappingTemplate.dynamoDbScanTable(),
        responseMappingTemplate: MappingTemplate.dynamoDbResultList(),
});

by ID works - with nice quick response image