https://github.com/a8m/dynamose
A Promise-Based DynamoDB Client
https://github.com/a8m/dynamose
Last synced: 2 months ago
JSON representation
A Promise-Based DynamoDB Client
- Host: GitHub
- URL: https://github.com/a8m/dynamose
- Owner: a8m
- Created: 2014-11-09T15:19:38.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2014-12-15T12:55:11.000Z (over 11 years ago)
- Last Synced: 2025-10-19T16:21:56.281Z (8 months ago)
- Language: JavaScript
- Size: 156 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
#A Promise-Based DynamoDB Client
[](https://travis-ci.org/a8m/dynamose)
[](https://coveralls.io/r/a8m/dynamose)
**Dynamose** is a client for the Amazon's DynamoDB that gives you to deal with promises instead of callbacks. **v0.0.1**
###Installing
**git:**
```sh
$ git clone https://github.com/a8m/dynamose.git
```
**npm:**
```sh
$ npm install dynamose --save
```
###Usage
```js
var Dynamose = require('dynamose');
// use Dynamose.AWS to config `AWS`
// for those who don't wanna require `AWS` in index.js
Dynamose.AWS.config.update({
accessKeyId: config.accessKeyId,
secretAccessKey: config.secretAccessKey,
region: config.region
});
// Dynamose constructor get two optional argument
// options => DynamoDB object options
// prettify => whether or not to prettify the returned data, by default set to true
var db = new Dynamose();
// get one item
db.getItem(params)
.then(console.log) // { name: 'foo_bar', value: [ 1, 2, 3 ] }
var unprettyDB = new Dynamose({}, false);
unprettyDB
.getItem(params)
.then(console.log) // { Item: { name: { S: 'foo_bar' }, value: { SN: [1, 2, 3] } } }
// use Promise.all/.props to fulfill more the one request
var Promise = require('bluebird');
Promise.props({
accounts: db.getItem(params1),
users : db.getItem(params2),
orders : db.getItem(params3)
}).then(console.log); // { accounts: { ... }, { users: { ... }, orders: { ... } } }
```