-
-
Save paulspringett/ec6d3df65e977342d6ea 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
var aws = require('aws-sdk'); | |
var db = new aws.DynamoDB(); | |
exports.handler = function(signup, context) { | |
console.log('Received signup:', JSON.stringify(signup, null, 2)); | |
var query = { | |
TableName: 'Signups', | |
Item: { | |
Id: { 'S': signup.id }, | |
EmailAddress: { 'S': signup.email_address }, | |
CreatedAt: { 'S': new Date().toISOString() } | |
} | |
}; | |
db.putItem(query, function (err, data) { | |
if (err) { | |
console.log(JSON.stringify(err, null, 2)); | |
context.fail('Error with putItem'); | |
} else { | |
context.succeed({ success: true }); | |
} | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment