Last active
February 22, 2018 23:31
-
-
Save mako34/4480221ff4cd48243ae7aa6b16f69845 to your computer and use it in GitHub Desktop.
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
| //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