Skip to content

Instantly share code, notes, and snippets.

@vishwasnavadak
Last active November 18, 2018 13:04
Show Gist options
  • Save vishwasnavadak/7558495baafc8156064b7e13690cbdc6 to your computer and use it in GitHub Desktop.
Save vishwasnavadak/7558495baafc8156064b7e13690cbdc6 to your computer and use it in GitHub Desktop.
Lambda Functions to fetch data from DynamoDB
var AWS = require('aws-sdk'),
myDocumentClient = new AWS.DynamoDB.DocumentClient();
exports.todoFetchItems = function(event, context, callback) {
var params ={
TableName: 'TABLE_NAME'
};
myDocumentClient.scan(params, function(err, data){
if(err){
callback(err,null);
} else {
callback(null,data.Items);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment