Backend Routes - minwang2022/SplitDice GitHub Wiki

Backend Routes

HTML

  • GET / StaticPagesController#home

API Endpoints

users

  • GET /api/users/:id return to user profile where contains username, email, phone number, etc..
  • GET /api/groups/:group_id/users returns a list of users in a group
  • POST /api/users/ signup the user and return info of current user
  • PATCH /api/users/:id edit the current user
  • DELETE /api/users/:id delete the current user account

Session

  • POST /api/session logging in a user
  • DELETE /api/session logging out a user

Expenses

  • GET /api/expenses/:id return to a specific expense
  • GET /api/expenses returns a list show all current user expenses
  • POST /api/expenses/ create a new expense
  • PATCH /api/expenses/:id edit the current expense
  • DELETE /api/expenses/:id delete the current expense

Notes: DELETE of the current expense will trigger polymorph which all users have the same expense will be deleted.

Groups

  • GET /api/groups/:id return to a specific group
  • GET /api/groups returns a list show all groups of current user
  • POST /api/groups/ create a new group
  • PATCH /api/groups/:id edit the current group
  • DELETE /api/expenses/:id delete the current group

Friends

  • GET /api/friends/:id return to a specific friend
  • GET /api/friends returns a list show all current user's friends
  • POST /api/friends create a new friend
  • DELETE /api/friends/:id delete the friend of current user

Comment

  • GET /api/expenses/expense_id/comments/:id show the comment under a specific expense
  • DELETE /api/expenses/expense_id/comments/:id delete the comment under a specific expense

Notes: Comment is nested under expense, and only have show and delete.