Skip to content

Instantly share code, notes, and snippets.

@mako34
Last active February 22, 2018 23:31
Show Gist options
  • Select an option

  • Save mako34/4480221ff4cd48243ae7aa6b16f69845 to your computer and use it in GitHub Desktop.

Select an option

Save mako34/4480221ff4cd48243ae7aa6b16f69845 to your computer and use it in GitHub Desktop.
//https://www.youtube.com/watch?v=G_-aEXmluq8
console.log('emezao');
const AWS = require('aws-sdk');
const docClient = new AWS.DynamoDB.DocumentClient({region:'us-east-1'});
exports.handler = function (e, ctx, callback){
console.log('handler empezo');
//SCAN ALL
// var scanningParameters = {
// TableName : "guestbook",
// Limit : 100
// };
// docClient.scan(scanningParameters, function(err, data){
// if (err) {
// callback(err, null);
// }else{
// callback(null, data);
// }
// });
//QUERY
var params = {
TableName : "guestbook",
Key:{
"date":1486535184805
}
}
docClient.get(params, function(err, data){
if (err) {
callback(err, null);
}else{
callback(null, data)
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment