Skip to content

Commit

Permalink
Browser support
Browse files Browse the repository at this point in the history
  • Loading branch information
noppoMan committed Jul 23, 2015
1 parent 44dd12d commit 859432e
Show file tree
Hide file tree
Showing 11 changed files with 3,179 additions and 35 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
.DS_Store
npdfile.js
examples
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,54 @@ npd migrate:rollback
npm test
```

## Browser Support
Npdynamodb can be built using browserify or webpack, and pre-built or pre-built with uglified version can be found in the build directory.

#### Note that, if you use Npdynamodb on any browsers, It has a security issue. Because AccessKey and SecretAccessKey for DynamoDB can be seen from public. We recommend you only using it for private or readonly projects which is not including any privacy informations.


### For Browserify or Webpack
```js
var AWS = require('aws-sdk');
var npdynamodb = require('npdynamodb/build/npdynamodb');

var dynamodb = new AWS.DynamoDB({
apiVersion: '2012-08-10',
accessKeyId: "here is key",
secretAccessKey: "here is secret key",
region: "ap-northeast-1",
sslEnabled: true,
});

var npd = npdynamodb.createClient(dynamodb);
npd().table('table_name').where('id', 1).then(function(data){
console.log(data);
});
```

### For HTML
```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/aws-sdk/2.1.39/aws-sdk.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.10.0/lodash.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bluebird/2.9.33/bluebird.min.js"></script>
<script src="../build/npdynamodb.min.js"></script>
<script>
var dynamodb = new AWS.DynamoDB({
apiVersion: '2012-08-10',
accessKeyId: "here is key",
secretAccessKey: "here is secret key",
region: "ap-northeast-1",
sslEnabled: true,
});
var npd = npdynamodb.createClient(dynamodb);
npd().table('table_name').where('id', 1).then(function(data){
console.log(data);
});
</script>
```


## License

(The MIT License)
Expand Down
Loading

0 comments on commit 859432e

Please sign in to comment.