Skip to content

Instantly share code, notes, and snippets.

@mlabouardy
Created October 26, 2017 13:18
Show Gist options
  • Save mlabouardy/9d84611bd70780fd9e1386cc3983a6cc to your computer and use it in GitHub Desktop.
Save mlabouardy/9d84611bd70780fd9e1386cc3983a6cc to your computer and use it in GitHub Desktop.
Read data from DynamoDB
'use strict';
var AWS = require('aws-sdk'),
documentClient = new AWS.DynamoDB.DocumentClient();
exports.readAllMovies = function(event, context, callback){
var params = {
TableName : process.env.TABLE_NAME
};
documentClient.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