Created
February 21, 2018 08:23
-
-
Save chathurawidanage/60150dbaf5536d1b3c04e3c860113205 to your computer and use it in GitHub Desktop.
This file contains 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
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