Skip to content

BillIvanKoo/redclone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 

Repository files navigation

Redclone

Reddit's clone

Purpose of this project:

  • to learn spring boot:
    • authentication/authorisation using jwt
    • mySQL
    • hibernate/JPA
    • testing using junit
  • to learn react hooks

Check it out at: http://redclone.site

  • Back-end is hosted with AWS EC2 and RDS (spring application.properties for production is not committed to github for obvious reasons)
  • Front-end is hosted with AWS S3 and Cloudflare CDN

How to run back-end locally

cd server/
mvn install
mvn spring-boot:run
# The server will be run at localhost:8080

How to run front-end locally

cd client/
yarn add
yarn start
# the client will be run at localhost:3000

API

Http Method Route Description Header Body Response
POST /users/sign-up Register a new user { username:string, password:string }
POST /authenticate Login { username:string, password:string } JWT for auth
GET /users/profile Get user info from token { "Authorization": "Bearer " + JWT } User info
GET /posts Get page of posts Page of posts
GET /posts/:id Get post based on id The post
GET /posts/user/:id Get posts based on user id Page of posts
GET /posts/parent/:id Get posts (comments) based on parent id (post that is commented) Page of posts
POST /posts Create a post { "Authorization": "Bearer " + JWT } { "content":string } The created post
POST /posts/parent/:id Comment on a post with (parent) id { "Authorization": "Bearer " + JWT } { "content":string } The created post (commment)
PUT /:id Update post content { "Authorization": "Bearer " + JWT } { "content":string } The updated post
DELETE /:id Delete post { "Authorization": "Bearer " + JWT }
GET /votes/user/:id Get votes based on user id List of votes
GET /votes/post/:id Get votes based on post id List of votes
POST /votes/post/:id Vote on a post (based on id) { "Authorization": "Bearer " + JWT } { "up":boolean } The created vote
PUT /:id Edit vote { "Authorization": "Bearer " + JWT } { "up":boolean } The edited vote
DELETE /:id Delete vote { "Authorization": "Bearer " + JWT }

Resources used:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published