Skip to content

backend routes

eric2523 edited this page Oct 15, 2020 · 15 revisions

Backend Routes

HTML

  • GET / StaticPagesController#root

API Endpoints

users

  • GET /api/users/:id - returns a user's information for User Search feature
  • POST /api/users - sign up user

session

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

workout_classes

  • GET /api/workout_classes/:id - returns information about a class
  • GET /api/users/:user_id/workout_classes - returns information about classes that a user has signed up for

categories

  • GET /api/categories - returns information about all categories
  • GET /api/classes/category/:id - returns information about a category's classes

challenges

  • GET /api/challenges - returns info about all challenges
  • GET /api/challenges/:id - returns information about a single challenge

users_workout_classes

  • POST /api/users_workout_classes - follow a class with user information in payload of AJAX request
  • DELETE /api/users_workout_classes/:id - unfollow a class

user_follows

  • GET /api/users/:user_id/user_follows - returns all users that a user is following
  • POST /api/users/:user_id/user_follows - follow a user with user_id as followed_user_id and current_user.id as user_id
  • DELETE /api/user_follows/:id - unfollow a user

user_challenges

  • GET /api/users/:user_id/user_challenges - returns all challenges of a user
  • POST /api/challenges/:id/user_challenges - follow a challenge using current_user.id as user_id
  • DELETE /api/user_challenges/:id - unfollow a challenge