Skip to content

Instantly share code, notes, and snippets.

@chathurawidanage
Created February 21, 2018 08:23
Show Gist options
  • Save chathurawidanage/60150dbaf5536d1b3c04e3c860113205 to your computer and use it in GitHub Desktop.
Save chathurawidanage/60150dbaf5536d1b3c04e3c860113205 to your computer and use it in GitHub Desktop.
let AWS = require('aws-sdk');
const ddb = new AWS.DynamoDB.DocumentClient();
exports.handler = function(event, context, callback) {
let now = new Date().getTime();
ddb.put({
TableName: 'contact_us',
Item: {
'name': event.name,
'email': event.email,
'phone': event.phone,
'company': event.company,
'comment': event.comment,
'date': now
}
}, function(err, data) {
if (err) {
callback(err, null);
} else {
callback(null, "Successfully Saved Entry!");
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment