Created
February 8, 2017 06:29
-
-
Save mako34/02a3d6bafa7fa7f8c3d0db4581df99e4 to your computer and use it in GitHub Desktop.
lambda 2 dynamo
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'); | |
| //logea event! | |
| console.log('entro e con:'+e); //como logea correcto? | |
| console.log(e); | |
| var params = { | |
| Item:{ | |
| date: Date.now(), | |
| message:"tkt" | |
| }, | |
| TableName:'guestbook' | |
| }; | |
| docClient.put(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