1.0.0 • Published 7 years ago

dynamodb-keyvalue v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

dynamodb-keyvalue

Use AWS dynamodb as a key/value storage.

Create table

aws dynamodb create-table --table-name lambda \
  --attribute-definitions AttributeName=id,AttributeType=S \
  --key-schema AttributeName=id,KeyType=HASH

API

var KV = require('dynamodb-keyvalue');

KV.TableName = 'lambda'; // lambda is the default

get('no-birthday-date', function() {
  console.log(arguments);

  // Data will be stringified, and returned as string!
  // to store/retrieve use JSON.stringify/parse
  set('no-birthday-date', new Date(), function(err, data) {
    if (err) {
      // there is an error
    }
    if (data === undefined) {
      // there is a possible error in JSON.stringify, your value
    }
    console.log(data); // {id: xx, value: yy}
  });
});

LICENSE

MIT