A simple social network backend REST API with persistent data.
I'm using AWS serverless application model and (1) rust lambda function to implement the API.
I'm using AWS Dynamodb as a database and single table design to store and retrieve relational data.
DynamoDB main table
DynamoDB global secondary index 1
curl --request POST \
--url $BASE_URL/user/create \
--header 'Content-Type: application/json' \
--data '{ "user_id": "harry", "password": "pass123" }'
curl --request POST \
--url $BASE_URL/story/create \
--header 'Content-Type: application/json' \
--data '{ "user_id": "harry", "content": "first story" }'
curl --request POST \
--url $BASE_URL/comment/create \
--header 'Content-Type: application/json' \
--data '{ "user_id": "harry", "story_id": "<STORY_ID>", "content":"A comment" }'
curl --request GET \
--url $BASE_URL/stories/harry
curl --request GET \
--url $BASE_URL/comments/<STORY_ID>
curl --request POST \
--url $BASE_URL/comment/delete \
--header 'Content-Type: application/json' \
--data '{ "comment_id": "<COMMENT_ID>", "story_id": "<STORY_ID>" }'
curl --request POST \
--url $BASE_URL/story/delete \
--header 'Content-Type: application/json' \
--data '{ "user_id": "harry", "story_id": "<STORY_ID>" }'
curl --request POST \
--url $BASE_URL/user/delete \
--header 'Content-Type: application/json' \
--data '{ "user_id": "harry" }'
# build and deploy
sam build
sam deploy
#logs
sam logs --stack-name <stackname> --name <FnName>