-
Notifications
You must be signed in to change notification settings - Fork 0
Backend Routes
thedanielcho edited this page May 12, 2021
·
10 revisions
-
GET /StaticPagesController#root
-
GET /api/channels/:channel_id/usersreturns a list of users in a specified channel -
GET /api/direct_messages/:direct_message_id/usersreturns a list of users in a specified DM -
GET /api/users/:idreturns all info for a single user -
POST /api/userscreates a new user in the database and returns user's info -
PATCH /api/users/:idif user being edited is current user
-
POST /api/sessionlog in -
DELETE /api/sessionlog out
-
GET /api/channelsreturns a list of all channels -
GET /api/channels/:idreturns all the information for a specified channel -
POST /api/channelscreates a new channel in the database, setting the admin as current user and returns that channel's info -
PATCH /api/channels/:idedit a channel if current user is the admin -
DELETE /api/channels/:iddelete a channel if current user is the admin -
GET /api/channels/searchcustom route that that uses a query string to return a list of channels that match the query string
-
GET /api/channels/:channel_id/messagesreturns a list of all messages for a specified channel -
GET /api/direct_messages/:direct_message_id/messagesreturns a list of all messages for a specified DM -
POST /api/channels/:channel_id/messagescreates a new message in the specified channel -
POST /api/direct_messages/:direct_message_id/messagescreates a new message in the specified DM -
PATCH /api/messages/:idedits a message if message's creator is current user -
DELETE /api/messages/:iddeletes a message if message's creator is current user
-
GET /api/users/:user_id/direct_messagesreturns a list of all DMs a user is in -
GET /api/direct_messages/:idreturns all the information for a specified DM -
POST /api/direct_messagescreates a new DM in the database
Note: There's no edit or delete route because there's nothing to edit and DM's can't be deleted
-
POST /api/channels/:channel_id/membershipsadds a user to specified channel -
DELETE /api/channels/:channel_id/membershipsremoves current user from specified channel
Note: Not entirely sure how to handle memberships for DMs since I can't tell if you can actually leave a DM/if leaving one deletes that entry in the database table, and I don't think you can add users to a DM after it's already been created.