Routes - lisza/storie GitHub Wiki
API Endpoints
users
GET /api/users/:id
users#show
- Returns author profile, with a feed of that author's storiesPOST /api/users/
users#create
- Sign upPATCH /api/users/:id
users#update
- Edit profile
stories
GET /api/stories
stories#index
- Returns a feed of all stories, or some filtered version thereofGET /api/stories/:id
stories#show
- Returns a single storyPOST /api/stories
stories#create
- Create a new storyPATCH /api/stories/:id
stories#update
- Edit storyDELETE /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 commentDELETE /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 storyDELETE 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 authorDELETE 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