Backend Routes - app-academy-exercises-jb/YASC GitHub Wiki
Backend Routes
HTML
GET /* => ApplicationController#root
API
Users
GET api/users/:id => Api::UsersController#show
- get specific user according to params. similar to slack:
users.info
GET api/users => Api::UsersController#index
- get list of users according to params. similar to slack:
users.list
POST api/users => Api::UsersController#create
PUT api/users/:id => Api::UsersController#update
DELETE api/users/:id => Api::UsersController#delete
Session
POST api/session => Api::SessionsController#create
DELETE api/session => Api::SessionsController#delete
Workspaces
GET api/workspaces/:id => Api::WorkspacesController#show
- get current snapshot of workspace. first route the client hits when bootstrapping. similar to slack:
client.boot or rtm.start
GET api/workspaces/:id/counts => Api::WorkspacesController#counts
- get current snapshot of workspace-level info for a given user. similar to slack:
client.count
POST api/workspaces => Api::WorkspacesController#create
POST api/workspaces/:id/members => Api::WorkspacesController#join
- add a member to a workspace
POST api/workspaces/:id/members => Api::WorkspacesController#leave
- remove a member to a workspace
DELETE api/workspaces/:id => Api::WorkspacesController#destroy
Channels
GET api/channels/:id => Api::ChannelsController#show
- get specific channel state. similar to slack:
channels.info, or conversations.view
POST api/channels => Api::ChannelsController#create
DELETE api/channels/:id => Api::ChannelsController#delete
POST api/channels/:id/members => Api::ChannelsController#join
- make a user a member of a channel
DELETE api/channels/:id/members => Api::ChannelsController#leave
- delete a user from a channel
Messages
GET api/channel/:id/messages => Api::MessagesController#index
- get messages for a given channel. similar to slack:
conversations.history
POST api/messages => Api::MessagesController#create
- create new message. similar to slack:
chat.postMessage
PUT api/messages/:id => Api::MessagesController#update
DELETE api/messages/:id => Api::MessagesController#delete
POST api/messages/:id/members => Api::MessagesController#join
- make a user a member of a thread
DELETE api/messages/:id/members => Api::MessagesController#leave
- delete a user from a thread