Skip to content

Backend Routes

Jonathan Calixto edited this page Sep 21, 2020 · 5 revisions

HTML

* GET / StaticPagesController#root

Users

* GET /api/users - 'shows the users information'
* POST /api/users - 'sends a request to create a new user'
* PATCH /api/users - 'sends a request to update a user'

Session

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

Photos

* GET /api/photos - 'route to view all photos'
* GET /api/photos/:id - 'route to view an individual photo'
* POST /api/photos - 'sends a request to upload a photo'
* PATCH /api/photo/:id - 'sends a request to update/edit a photo's details'
* DELETE /api/photo/:id - 'sends a request to delete a photo'

Comments

* GET /api/photos/:photo_id/comments - 'sends a request to get all comments to a specific photo'
* POST /api/comments/ - 'sends a request to create a new comment' => user must be logged in
* PATCH /api/comments/ - 'sends a request to edit a comment' => user must be logged in and only original commenter can edit their comment
* DELETE /api/comments/:id - 'sends a request to delete a comment' => user must be logged in and only original commenter can delete their comment

Galleries

* GET /api/galleries/gallery_id/photos - 'sends a request for all photos in the gallery'
* GET /api/galleries/gallery_id/photo/:id - 'sends a request for an individual photo in the gallery'
* POST /api/galleries - 'sends a request to make a new gallery'
* POST /galleries/:gallery_id/photos/:id/add - 'sends a request to add a photo to the gallery.'
* DELETE /api/galleries/gallery_id/photos/:id - 'sends a request to remove a photo from the gallery'
* DELETE /api/galleries/:id - 'sends a request to delete a gallery'

Categories

* GET /api/categories/- 'sends a request for all categories'
* GET /api/categories/:id - 'sends a request for an individual category and all photos in the category'

Follows

* POST /api/follows/- 'sends a request to follow a user'
* DELETE /api/follows/:id - 'sends a request to unfollow a user'

Likes

* POST /api/likes - 'sends a request to like a photo
* DELETE /api/likes/:id - 'sends a request to unlike a photo'
Clone this wiki locally