Giter Site home page Giter Site logo

simple-social-network's Introduction

Simple social network

A simple social network backend REST API with persistent data.

Overview

I'm using AWS serverless application model and (1) rust lambda function to implement the API.

API overview

Data model

I'm using AWS Dynamodb as a database and single table design to store and retrieve relational data.

DynamoDB main table

Main table

DynamoDB global secondary index 1

GSI 1

API

Create User

curl --request POST \
  --url $BASE_URL/user/create \
  --header 'Content-Type: application/json' \
  --data '{ "user_id": "harry", "password": "pass123" }'

Create Story

curl --request POST \
  --url $BASE_URL/story/create \
  --header 'Content-Type: application/json' \
  --data '{ "user_id": "harry", "content": "first story" }'

Create Comment

curl --request POST \
  --url $BASE_URL/comment/create \
  --header 'Content-Type: application/json' \
  --data '{ "user_id": "harry", "story_id": "<STORY_ID>", "content":"A comment" }'

List Stories for User

curl --request GET \
  --url $BASE_URL/stories/harry

List Comments for Story

curl --request GET \
  --url $BASE_URL/comments/<STORY_ID>

Delete Comment

curl --request POST \
  --url $BASE_URL/comment/delete \
  --header 'Content-Type: application/json' \
  --data '{ "comment_id": "<COMMENT_ID>", "story_id": "<STORY_ID>" }'

Delete Story

curl --request POST \
  --url $BASE_URL/story/delete \
  --header 'Content-Type: application/json' \
  --data '{ "user_id": "harry", "story_id": "<STORY_ID>" }'

Delete User

curl --request POST \
  --url $BASE_URL/user/delete \
  --header 'Content-Type: application/json' \
  --data '{ "user_id": "harry" }'

Development

# build and deploy
sam build
sam deploy

#logs
sam logs --stack-name <stackname> --name <FnName>

simple-social-network's People

Contributors

harry-anderson avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.