Skip to content

Backend Routes

maggiecs edited this page Jan 22, 2019 · 3 revisions

Backend Routes

HTML

  • GET / StaticPagesController#root

API Endpoints

users

  • GET /api/users - returns the user information of displayed posts 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)
  • GET /api/posts/:id - returns post
  • POST /api/posts - creates a post
  • PATCH /api/posts/:id - edit a post
  • DELETE /api/posts/:id - remove a post

comments

  • GET /api/posts/:postid/comments/:id - returns comments on a post
  • POST /api/posts/:postid/comments - creates a comment on a post
  • DELETE /api/comments/:comment_id - remove a comment on a post

likes

  • POST /api/posts/:post_id/likes - like a post
  • DELETE /api/posts/:post_id/likes - unlike a post
  • POST /api/comments/:comment_id/likes - like a comment
  • DELETE /api/comments/:comment_id/likes - unlike a comment

Note: likes does not include a GET route because we will have these routes render the api/posts/show.json.jbuilder view. See Sample State.

Clone this wiki locally