Skip to content

Commit a011fe8

Browse files
committed
Initial structure of dynamodb connector for LoopBack
0 parents  commit a011fe8

File tree

11 files changed

+521
-0
lines changed

11 files changed

+521
-0
lines changed

.eslintrc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
env:
2+
node: true
3+
4+
plugins:
5+
- nodeca
6+
7+
rules:
8+
nodeca/indent: 2
9+
quotes: 'single'
10+
11+
ignore-path:
12+
- .eslintignore

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
coverage

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright © 2014 Clay Loveless <[email protected]>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of
6+
this software and associated documentation files (the “Software”), to deal in
7+
the Software without restriction, including without limitation the rights to
8+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
9+
of the Software, and to permit persons to whom the Software is furnished to do
10+
so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
## TESTS
2+
3+
TESTER = ./node_modules/.bin/mocha
4+
OPTS = -G --timeout 10000
5+
TESTS = test/*.test.js
6+
7+
test:
8+
$(TESTER) $(OPTS) $(TESTS)
9+
test-verbose:
10+
$(TESTER) $(OPTS) --reporter spec $(TESTS)
11+
testing:
12+
$(TESTER) $(OPTS) --watch $(TESTS)
13+
.PHONY: test docs

README.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
## loopback-connector-dynamodb
2+
3+
DynamoDB connector for loopback-datasource-juggler. Because Dynamo doesn't get enough love.
4+
5+
## DynamoDB connector
6+
7+
* Installation
8+
* Creating a DynamoDB data source
9+
* Properties
10+
* Using the DynamoDB connector
11+
* Local development with DynamoDB Local
12+
13+
### Installation
14+
15+
In your application root directory, enter:
16+
17+
$ npm install loopback-connector-dynamodb --save
18+
19+
This will install the module from npm and add it as a depenency to the application's [package.json](http://docs.strongloop.com/display/LB/package.json) file.
20+
21+
### Creating a DynamoDB data source
22+
23+
Use the [Datasource generator](http://docs.strongloop.com/display/LB/Datasource+generator) to add a DynamoDB data source to your application. The entry in the application's `/server/datasources.json` will look like this:
24+
25+
```json
26+
"mydb": {
27+
"name": "mydb",
28+
"connector": "dynamodb"
29+
}
30+
```
31+
32+
Edit `datasources.json` to add other properties to enable you to connect the data source to a DynamoDB database.
33+
34+
### Properties
35+
36+
Property | Type | Description
37+
-------- | ---- | -----------
38+
connector | String | Connector name, either `loopback-connector-dynamodb` or `dynamodb`
39+
region | String | AWS Region to connect to. May also be set to `local` to use an instance of DynamoDB Local.
40+
debug | Boolean | If `true`, turn on verbose mode to debug requests and lifecycle.
41+
credentials | String | Method to locate credentials for the AWS SDK for Javascript. Valid values are: `env`, `shared`, `iamrole`, `file`. Default value: `shared`.
42+
credfile | String | If credentials method is `file`, specify the location of the JSON file to load.
43+
profile | String | Name the profile to use if using the `shared` credentials method.
44+
endpoint | Number | URL to use connecting to DynamoDB Local. Default is `8000`. Example: `http://localhost:8000/` Note: this property is ignored if `region` is not `local`.
45+
46+
For example:
47+
48+
*Example datasources.json file*
49+
```json
50+
{
51+
"dynamo_dev": {
52+
"name": "dynamo_dev",
53+
"connector": "dynamodb",
54+
"region": "local",
55+
"credentials": "shared",
56+
"profile": "localdev",
57+
"port": 4567
58+
},
59+
"dynamo_qa": {
60+
"name": "dynamo_qa",
61+
"connector": "dynamodb",
62+
"region": "us-west-2",
63+
"credentials": "iamrole"
64+
}
65+
}
66+
```
67+
68+
:warning: You can't specify `aws_access_key_id` and `aws_secret_access_key` directly in your `datasources.json` file.
69+
This is intentional. Putting credentials like that into a file are A Very Bad Thing. Quit trying to do that.

docs.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"content": [
3+
{"title": "LoopBack DynamoDB Connector API", "depth": 2},
4+
"lib/dynamodb.js"
5+
],
6+
"codeSectionDepth": 3
7+
}
8+

index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('./lib/dynamodb');

0 commit comments

Comments
 (0)