https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.DownloadingAndRunning.html https://docs.aws.amazon.com/cli/latest/userguide/installing.html
aws dynamodb create-table --cli-input-json file:///<Project_root>/db/tables/create_table_user.json --region us-east-1 --endpoint-url http://localhost:8000
aws dynamodb list-tables --endpoint-url http://localhost:8000
aws dynamodb batch-write-item --request-items file:///<Project_root>/db/tables/load_data_user.json --endpoint-url http://localhost:8000
aws dynamodb scan --table-name USER --endpoint-url http://localhost:8000
git clone https://github.com/alowsarwar/es6-expressjs-api-jwt-dynamodb.git
Then CD in to it
Server starts at http://localhost:5000
curl -X POST \
http://localhost:5000/login \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Postman-Token: 053b531f-f1cd-4611-bd40-000b6aabeddf' \
-d 'email=user2%40mail.com&password=pass2'
Copy the token from response, This response will go into header for subsequent API calls. This token is valid for 30 minutes.
{"auth":true,"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1MzgxMTkyNjIsImV4cCI6MTUzODExOTI5Mn0.4ENUMKdOWBhE98dfKX9BsHTpvh0Q71PBWaaLbXex1kM"}%
curl -X GET \
http://localhost:5000/api/v1/todos \
-H 'Cache-Control: no-cache' \
-H 'Postman-Token: 5177bd39-ad8e-443c-80fd-82f06ba6b9aa' \
-H 'token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1MzgxMTk1NTQsImV4cCI6MTUzODEyMTM1NH0.yvL08KwD_rULN7OB54m0Ut70Zrwy2uc3ltqVocj9GPY'
curl -X POST \
http://localhost:5000/api/v1/todos \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/json' \
-H 'Postman-Token: 46a62902-b3b6-4732-bef7-fb7d1bc622df' \
-H 'token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1MzgxMTk5MjksImV4cCI6MTUzODEyMTcyOX0.n64nxvv8UaieODFgH0Ybd3UNbyLk6_xtXeeKYcZiYcU' \
-d '{
"title": "new1",
"description": "new1"
}'