Backend Routes - connorryanbaker/slaq GitHub Wiki
HTML
- GET '/' => StaticPagesController#root
API Endpoints
Users
- POST 'api/users' => UsersController#create
- PATCH 'api/users/:id' => UsersController#update
- DELETE 'api/users/:id' => UsersController#destroy
Session
- POST 'api/session' => SessionController#create
- DELETE 'api/session' => SessionController#destroy
Messages
-
POST 'api/messages' => MessagesController#create
-
PATCH 'api/messages/:id' => MessagesController#update
-
DELETE 'api/messages/:id' => MessagesController#destroy
-
the idea behind nesting #create/update is that messages have a foreign_key to the channel/dm in which they were created, nesting the route will facilitate easier access to this data
Workspaces
- GET 'api/workspaces/:id' => WorkspacesController#show - this will .includes() Workplace.messages, Workplace.users, current_user.channels / workplace.channels
- POST 'api/workspaces' => WorkspacesController#create - create new workplace
Channels
- GET 'api/workspaces/:workspace_id/channels/:id
- POST 'api/workspaces/:workspace_id/channels' => ChannelsController#create - create a new channel, nested because of the workspace_id foreign_key in channels
- DELETE '/api/channels/:id'
DMs
- GET 'api/workspaces/:workspace_id/dms/:id => DMsController#show - get one dm
- POST 'api/workspaces/:workspace_id/dms' => DMsController#create - create a new dm, nested because of the workspace_id foreign_key in dms