Skip to content

Backend Routes

lk340 edited this page Jan 20, 2019 · 1 revision

Back-end Routes

HTML

  • GET / StaticPagesController#root

API Endpoints

users

  • GET /api/users - returns the user information of displayed chirps and for the User Search feature
  • POST /api/users - sign up

session

  • POST /api/session - log in
  • DELETE /api/session - log out

posts

  • GET /api/posts - returns relevant posts (filtered by data/params) stored in the back-end database
  • GET /api/posts/:id - returns a specific post from the back-end database
  • POST /api/posts - persists a new post into the back-end database
  • PATCH /api/posts/:id - edit a post and persists new data into the back-end database
  • DELETE /api/posts/:id - remove a post from the back-end database

likes

  • POST /api/posts/:post_id/likes - persists's user's liking of a post to back-end to make sure they can't like a post more than once
  • DELETE /api/posts/:post_id/likes - removes user's liking of a post from the back-end; allows them to like the photo again

comments

  • GET /api/comments/:id - returns a comment from a post
  • POST /api/comments - persists a comment to the back-end database
  • PATCH /api/comments/:id - edit a comment and persists new data into the back-end database
  • DELETE /api/comments/:id - removes a user's comment on a post from the back-end database

Clone this wiki locally