Skip to content

thiskevinwang/dynamodb-graphql-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

52 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

graphql-server-example

Getting Started

git clone https://github.com/thiskevinwang/graphql-server-example.git
cd graphql-server-example
yarn install
yarn run develop

# go to localhost:4000

Education sources

AWS-SDK

Local DynamoDB w/ Docker

docker pull amazon/dynamodb-local
docker run -p 8000:8000 amazon/dynamodb-local

Dynamo Tutorial

Node:

DynamoDB Data Model

Cheatsheet

CLI Commands

Help
aws dynamodb help
List Tables
aws dynamodb list-tables help
aws dynamodb list-tables --endpoint-url http://localhost:8081
Scan
aws dynamodb scan help
aws dynamodb scan --table-name Snacks
Put Item
aws dynamodb put-item help
aws dynamodb put-item --table-name Snacks --item '{"Id": {"S": "1"}}'
Update Item
aws dynamodb update-item help

# Add / Overwrite Attribute
aws dynamodb update-item \
  --table-name Snacks \
  --key '{"Id": {"S": "1"}}' \
  --attribute-updates '{"MyNewAttributeName": {"Value": {"S":"Poteko"}}}'

# Actions --- [ADD, DELETE, PUT]

# Delete Attribute
# - "Value" (not required)
aws dynamodb update-item \
  --table-name Snacks \
  --key '{"Id": {"S": "1"}}' \
  --attribute-updates '{"MyNewAttributeName": {"Action": "DELETE" }}'

# Increment/Decrement a "N" Attribute
aws dynamodb update-item \
  --table-name Snacks \
  --key '{"Id": {"S": "1"}}' \
  --attribute-updates \
  '{"Count": {"Value": {"N":"0"}}}'

aws dynamodb update-item \
  --table-name Snacks \
  --key '{"Id": {"S": "1"}}' \
  --attribute-updates \
  '{ "Count": {"Action": "ADD",  "Value": {"N":"1"}}}'

aws dynamodb update-item \
  --table-name Snacks \
  --key '{"Id": {"S": "1"}}' \
  --attribute-updates \
  '{ "Count": {"Action": "ADD",  "Value": {"N":"-1"}}}'