Backend Routes - fjswayze/Shack GitHub Wiki

Backend Routes

HTML

  • GET / StaticPagesController#root

API Endpoints

users

  • GET /api/users/:id
    • returns info for the specified user.
    • Info includes profile picture, display name, status (optional).
  • POST /api/users/
    • sign up
  • GET /api/channels/:id/users
    • returns the users who belong to this channel
    • Users are displayed with their name + profile picture
  • GET /api/direct_messages/:id/users
    • returns the users who belong to this direct_message conversation
    • Users are displayed with their name + profile picture

messages

  • GET /api/channels/:id/messages
    • returns the messages for the specified channel
    • messages are displayed with a timestamp and their sender's name + profile picture
  • POST /api/channels/:id/messages/
    • creates a message in the channel
  • GET /api/direct_messages/:id/messages
    • returns the messages for the specified conversation
    • messages are displayed with a timestamp and their sender's name + profile picture
  • POST /api/direct_messages/:id/messages/
    • create a message in a direct_message conversation
  • PATCH /api/messages/:id
    • edit message
  • DELETE /api/messages/:id
    • edit message

channels

  • GET /api/channels/
    • returns all channels
  • GET /api/channels/:id
    • returns a channel
  • GET /api/users/:id/channels/
    • returns all of the specified user's channels
  • POST /api/channels/
    • creates a channel
  • DELETE /api/channels/:id
    • deletes a channel
  • PATCH /api/channels/:id/
    • edit a channel

direct_messages

  • GET /api/direct_messages/
    • return the users direct messages
  • GET /api/direct_messages/:id
    • returns direct message conversation
  • POST /api/direct_messages/
    • create a direct_message conversation
  • DELETE /api/direct_messages/
    • deletes a direct_message conversation

memberships

  • POST /api/direct_messages/:id/memberships
    • add a user to a direct message convo
  • Delete /api/direct_messages/:id/memberships
    • remove a user to a direct message convo
  • POST /api/channels/:id/memberships
    • add a user to a channel
  • Delete /api/channels/:id/memberships
    • remove a user from a channel