Routes - lisza/storie GitHub Wiki

API Endpoints

users

  • GET /api/users/:id users#show - Returns author profile, with a feed of that author's stories
  • POST /api/users/ users#create - Sign up
  • PATCH /api/users/:id users#update - Edit profile

stories

  • GET /api/stories stories#index - Returns a feed of all stories, or some filtered version thereof
  • GET /api/stories/:id stories#show - Returns a single story
  • POST /api/stories stories#create - Create a new story
  • PATCH /api/stories/:id stories#update - Edit story
  • DELETE /api/stories/:id stories#delete - Remove story

Question: What happened to our stories#new and users#new routes?

comments

  • POST /api/stories/:story_id/comments comments#create - Post new comment
  • DELETE /api/comments/:id comments#destroy - Remove comment

Note: We don't need GET comments#index and POST comments#new routes for comments, because both routes render the stories#show view via views/api/stories/show.json.jbuilder

likes

  • POST api/likes likes#create - Like a story
  • DELETE api/likes likes#destroy - Unlike a story

Note: Both actions render views/api/stories/show.json.jbuilder so we don't need GET methods for likes#index or likes#show

follows

  • POST api/follows follows#create - Follow author
  • DELETE api/follows follows/destroy - Unfollow author

Note: Both actions render views/api/users/show.json.jbuilder so we don't need GET methods for follows#index or follows#show

Question: We don't need to provide an :id to the destroy action? Are we gonna look it up by current_user and shown user?


Frontend Routes

  • /login and /signup
  • /feed - Homepage, main story feed
  • /users/:userId - Author profile with feed of only that author's stories
  • /users/:userId/edit - Edit author profile
  • /stories/new - Create new story
  • /stories/:storyId - Show single story
  • /stories/:storyId/:edit - Edit story
  • /comments/new - Add a comment
  • /comments - Show all comments for a story