Created
October 26, 2017 13:18
-
-
Save mlabouardy/9d84611bd70780fd9e1386cc3983a6cc to your computer and use it in GitHub Desktop.
Read data from DynamoDB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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