Skip to content

Backend Routes

rayoowoo edited this page Jul 26, 2019 · 17 revisions

HTML

  • GET / StaticPagesController#root

API Endpoints

users

  • POST /api/users UsersController#create - a user signs up and creates an account in the database. returns the user's information.
  • GET /api/user/:user_id UsersController#show - returns the user's profile information, such as first and last names, birth date, profile picture url, photos. mostly for the profile page.
  • GET /api/users UsersController#index - returns a list of all the users, ideally for a search

session

  • POST /api/session SessionsController#create- user log in
  • DELETE /api/session SessionsController#destroy- user logs out

photos

this depends on what external image hosting API ends up being used

  • GET /api/photos PhotosController#index returns all the photos urls
  • POST /api/photos PhotosController#create adds a photo url to the database
  • GET /api/photos/:photo_id PhotosController#show returns the photo url of one photo

posts

  • GET /api/users/:user_id/posts PostsController#index - returns all the posts that are made to a user's timeline.
  • GET /api/users/:user_id/posts/:post_id PostsController#show - returns a single post along with the comments and the likes for when a post is too long, and is shown on one page.
  • POST /api/users/:user_id/posts PostsController#create - creates a post and returns the post information
  • PATCH /api/posts/:post_id PostsController#update - updates a post and returns the updated post information
  • DELETE /api/posts/:post_id PostsController#destroy - deletes a post from the database, along with all the comments and the likes on the post

comments

  • POST /api/posts/:post_id/comments CommentsController#create - creates a comments and returns the comment information
  • PATCH /api/comments/:comment_id CommentsController#update - updates a comment and returns the updated comment information
  • DELETE /api/comments/:comment_id CommentsController#destroy - deletes a comment from the database, along with any sub-comments or likes on the comment

NOTE: comments does not have a GET route for an index because we will have the comments be rendered in api/posts/show.json.jbuilder view.

workplaces

  • POST /api/workplaces WorkplacesController#create create a workplace and return the workplace information

NOTE: will be expanded if this can become a group

educations

  • POST /api/educations EducationsController#create create a education and return the education information

NOTE: will be expanded if this can become a group

locations

  • POST /api/locations LocationsController#create create a location and return the location information

NOTE: will be expanded if this can become a group

Clone this wiki locally