Skip to content

Commit

Permalink
backend framework
Browse files Browse the repository at this point in the history
  • Loading branch information
nihalmenon committed Nov 29, 2022
1 parent 063112f commit bd26441
Show file tree
Hide file tree
Showing 2,349 changed files with 1,826,937 additions and 0 deletions.
Binary file modified .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
33 changes: 33 additions & 0 deletions backend/read.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const AWS = require('aws-sdk')

// New ID key

const awsConfig = {
"region": "",
"endpoint": "",
"accessKeyId": ""
}
AWS.config.update(awsConfig)

const dynamoDB = new AWS.DynamoDB.DocumentClient()

const fetchOneByKey = () => {
const params = {
TableName: '',
Key: {
"id": ""
}
}
try {
docClient.get(params, (error, data) => {
if(error) {
console.log("error: " + JSON.stringify(error, null, ))
}else{
console.log(JSON.stringify(data,null,2));
}
})
} catch (e) {
console.log('error: ' + e)
}

}
43 changes: 43 additions & 0 deletions backend/update.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
const AWS = require('aws-sdk')

// New ID key

const awsConfig = {
"region": "",
"endpoint": "",
"accessKeyId": ""
}
AWS.config.update(awsConfig)

const dynamoDB = new AWS.DynamoDB.DocumentClient()

const updateOne = (counter) => {
const input = {
"time": time.time(),
"counter": counter // counter value here
}

const params = {
TableName: '',
Key: {
'id': ''
},
UpdateExpression: 'set counter = :counter',
ExpressionAttributeValues: {
':counter': counter
}
}

try {
dynamoDB.update(params, (error, data) => {
if(error) {
console.log("error: " + JSON.stringify(error, null, ))
}else{
console.log(JSON.stringify(data,null,2));
}
})
} catch (e) {
console.log('error: ' + e)
}

}
1 change: 1 addition & 0 deletions node_modules/.bin/uuid

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit bd26441

Please sign in to comment.