Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

update README.md

  • Loading branch information...
commit 4ceb2b5f3c2177fecda371ab028327a9f55408f1 1 parent 4a657d8
@xiepeng authored
Showing with 7 additions and 4 deletions.
  1. +2 −2 README.md
  2. +5 −2 example.js
View
4 README.md
@@ -1,6 +1,6 @@
## dynamoDB.js - a node.js module for accessing [Amazon DynamoDB](http://aws.amazon.com/dynamodb/ "click to go to Amazon DynamoDB").
-DynamoDB uses JSON for communication. That means both the request body and the response are in JSON format. This module wraps up the request and takes care of authentication. The user will be responsible for crafting the request and parsing the result.
+DynamoDB uses JSON for communication. That means both the request body and the response are in JSON format. This module wraps up the request and takes care of authentication. The user will be responsible for crafting the request and consuming the result.
Installation:
@@ -14,7 +14,7 @@ Usage:
var dynamoDB = require('./lib/dynamoDB').DynamoDB(credentials);
## Examples
-Each function has a callback with a [http.ClientResponse](http://nodejs.org/docs/latest/api/http.html#http.ClientResponse) object and a "result" object as the argument. The second object, "result", emitts an event 'ready' when all the response data are reveived, then parse the response into a javascript object.
+Each function has a callback with a [http.ClientResponse](http://nodejs.org/docs/latest/api/http.html#http.ClientResponse) together with a "result" object as the arguments. The second argument, "result", emitts an event 'ready' when all the response data are reveived, and parses the response into a javascript object.
### [CreateTable] (http://docs.amazonwebservices.com/amazondynamodb/latest/developerguide/API_CreateTable.html "reference on aws")
Create a table named "Table1" with HashKey "Color"(String) and RangeKey "Weight"(Numeric). Set the read capacity units to 5 and write capacity units to 10.
View
7 example.js
@@ -12,10 +12,13 @@ dynamoDB.createTable(
"RangeKeyElement":{"AttributeName":"Weight","AttributeType":"N"}},
"ProvisionedThroughput":{"ReadCapacityUnits":5,"WriteCapacityUnits":10}
}
- , function(result) {
- result.on('data', function(chunk){
+ , function(response,result) {
+ response.on('data', function(chunk){
console.log(""+chunk);
});
+ result.on('ready', function(data){
+ console.log('Creation of table was successful:' + !data.error);
+ });
});
*/
Please sign in to comment.
Something went wrong with that request. Please try again.