Skip to content

Commit e226138

Browse files
author
preddy017c
committed
Update readme for setting up the database
1 parent 9220c4f commit e226138

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,12 @@ To run the application locally
7878
1. Clone repo
7979
2. run npm install from root folder
8080
3. run node index.js
81-
4. browse to the ipaddress:port number (ie. locally it will be http://localhost:port
81+
4. browse to the ipaddress:port number (ie. locally it will be http://localhost:port
82+
83+
#Database
84+
To set dynamodb locally
85+
86+
1. Follow the instructions in the link to download and run dynamodb locally http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html
87+
2. Set up AWS credentially locally http://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/setup-credentials.html
88+
3. Once dynamodb is set up locally. Use the following to script to create a table and insert the data into the dynamodb (execute node database.js from terminal)
89+
4. While executing the script change table name and server information

database.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ AWS = require('aws-sdk');
2323
//default is the local profile
2424
AWS.config.credentials = new AWS.SharedIniFileCredentials({profile: 'default'});
2525
//change the end point and region of your own if you want to work with your dynamo account
26+
//change the table name in createTableParams and also while inserting the data
2627
AWS.config.update({
2728
region: 'us-east-1',
2829
endpoint: 'http://localhost:8000'
@@ -101,6 +102,8 @@ var createTableparams = {
101102
"AttributeType": "S"
102103
}
103104
],
105+
//change the table name to use your own
106+
//if you use your table name, change the table name in index.js in testServer endpoint or use (SpeedTestServerInfo) this table name
104107
"TableName": "TableName",
105108
"KeySchema": [
106109
{
@@ -162,6 +165,7 @@ var callback = function (data) {
162165
console.log(data);
163166
for (var i = 0; i < serverInfo.length; i++) {
164167
var updateParams = {
168+
//change the table name to match the above
165169
TableName: 'TableName',
166170
Item: {
167171
Hostname: {'S': serverInfo[i].Hostname},

0 commit comments

Comments
 (0)