Skip to content

Backend Routes

dch21 edited this page Nov 7, 2020 · 6 revisions

Backend Routes

HTML

GET / StaticPagesController#root

API Endpoints

users

POST /api/users - sign up
GET /api/users/:id - get logged in user showpage with reservation history, likes, and reviews                                                                
PATCH  /api/users/:id - edit user details                                                               
DELETE /api/users/:id - delete account                                                              

session

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

restaurants

 GET /api/restaurants- gets an index of all the restaurants (can be filtered by data or params)                                                              
 GET /api/restaurants/:id- show page for a particular restaurant    

reservations

GET /api/users/:id/reservations - returns all reservations for user as indicated by wildcard
POST /api/restaurants/:id/reservations - creates a reservation
PATCH /api/reservations/:id - edit a reservation
DELETE /api/reservations/:id - remove a reservation

reviews

GET /api/restaurants/:id/reviews - returns all reviews for restaurant indicated by wildcard
POST /api/restaurants/:id/reviews - creates a review
PATCH /api/reviews/:id - edit a review
DELETE /api/reviews/:id - remove a review

favorites

GET /api/users/:id/favorites - returns all favorite restaurants for that particular user
POST /api/favorites - creates a favorite 
DELETE /api/favorites/:id - remove a favorite (PATCH not needed since you can't edit something that is designated as favorite. It's either a favorite or not.)

Clone this wiki locally