Front End Routes - Ashley-B1/Rabbit-Hole GitHub Wiki

/

Home page:

  • Display the five most posts and their likes
  • A navbar with login/ signup buttons
  • Each post has an update and delete button if it belongs to currently logged in user
  • Logged in user can like the post on this page

Routes:

  • GET /: Display the five most recent posts and their likes
  • POST /posts/:id : Authorized user can edit their post
  • DELETE /posts/:id : Authorized user can delete their post
  • POST /posts/:id/likes
  • DELETE /posts/:id/likes

/login

Login Page

  • Display a log-in form

Routes:

  • GET /login: return a logged in form
  • POST /login: send user login data to backend

/signup

  • Sign up page: Display a sign-up form

Routes:

  • GET /signup: returns a page to either sign up for a new account
  • POST /signup: submits a new user data to the backend

/posts

  • A page display a form for creating a new post
  • A navbar with login, signup, logout buttons

Routes:

  • GET /posts: return all the recent posts in the last hour
  • POST /posts: submits a new post to the feed

/users/:id

  • Display all the posts of this user

Routes:

  • GET /users/:id : display all the posts of user

/posts/:id

  • A page that display a specific post with the id
  • Contains a navbar with login, signup, logout buttons
  • If the logged in user owns the post, display a edit and delete button
  • All logged in users can like this post, and leave comments on this page(post)

Routes:

  • GET /posts/:id : Display details of the post with the id, also display the comments of this post

  • PUT/PATCH /posts/:id : Authorized user can edit this post

  • DELETE /posts/:id : Authorized user can delete this post

  • POST /posts/:id/comments: logged in users can leave comments

  • PUT/PATCH /posts/:id/comments/:id : Authorized user can edit their comment

  • DELETE /comments/:id : Authorized user can delete their own comments

  • POST /posts/:id/likes

  • DELETE /posts/:id/likes