Skip to content

Instantly share code, notes, and snippets.

@vishwasnavadak
Created November 18, 2018 13:04
Show Gist options
  • Select an option

  • Save vishwasnavadak/40077dd29c9c4ccd50f2fd1a1300070c to your computer and use it in GitHub Desktop.

Select an option

Save vishwasnavadak/40077dd29c9c4ccd50f2fd1a1300070c to your computer and use it in GitHub Desktop.

Revisions

  1. vishwasnavadak revised this gist Nov 18, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion addDataDynamoDB.js
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@ var AWS = require('aws-sdk'),

    exports.todoGetItem = function(event, context, callback) {
    var params ={
    TableName: 'todolist',
    TableName: 'TABLE_NAME',
    Item: {
    'id' : uid.v1(),
    'desc' : event.desc,
  2. vishwasnavadak created this gist Nov 18, 2018.
    22 changes: 22 additions & 0 deletions addDataDynamoDB.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    var uid = require('uuid');
    var AWS = require('aws-sdk'),
    myDocumentClient = new AWS.DynamoDB.DocumentClient();

    exports.todoGetItem = function(event, context, callback) {
    var params ={
    TableName: 'todolist',
    Item: {
    'id' : uid.v1(),
    'desc' : event.desc,
    'isCompleted' : false,
    'timestamp' : new Date(Date.now()).toString()
    }
    };
    myDocumentClient.put(params, function(err, data) {
    if (err) {
    console.log("Error", err);
    } else {
    console.log("Success", data);
    }
    });
    }