SHARE
TWEET

Untitled

a guest Mar 18th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var AWS = require('aws-sdk');
  2. var dynamodb = new AWS.DynamoDB({
  3.         region: "eu-central-1",
  4.         apiVersion: '2012-08-10'
  5.     });
  6.    
  7. exports.handler = async (event) => {
  8.     var params = {
  9.         Key: {
  10.            "UserId": {
  11.              S: "user_1552474448003"
  12.             },
  13.           },
  14.           TableName: "compare-yourself"
  15.     };
  16.         let promise = new Promise((res, rej) => {
  17.         dynamodb.deleteItem(params, function(err, data) {
  18.           if (err) {
  19.             console.log("Error", err);
  20.             rej(err);
  21.           } else {
  22.             console.log(data)
  23.             res(data);
  24.           }
  25.         });
  26.     });
  27.     const result = await promise;
  28.     return result
  29. };
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top