Skip to content

API Documentation

lucianjones edited this page May 4, 2021 · 10 revisions

This is a layout of the API routes which will be used for CRUD functionality with the database.

Users

GET /api/users/:id -- Returns user data
POST /api/users/login -- Login user with provided credentials
  • Body: user login data
POST /api/users/signup -- Generates a new user object and creates a new session
  • Body: initial user data
DELETE /api/users/logout -- Logout user and delete session
PUT /api/users/:id -- Edit user data
  • Body: updated data
GET /api/users/:id/friends -- Returns a users friends
POST /api/users/:id/friends -- Add friends
  • Body: friend user object
DELETE /api/users/:id/friends/:fid -- Remove a friend

Servers

GET /api/servers/:id -- Used to get the main server page (general channel)
POST /api/servers -- Creates a new server instance
  • Body: initial server data
PUT /api/servers/:id -- Allows editing of server name
  • Body: updated server name
DELETE /api/servers/:id -- Permanently deletes a server

Channels

GET /api/channels/:id -- Used to get the specific channel
POST /api/channels -- Creates a new channel instance in a server
  • Body: initial server data
PUT /api/channels/:id -- Allows editing of channel name
  • Body: updated channel name
DELETE /api/channels/:id -- Permanently deletes a channel

Messages

POST /api/messages -- Used to create a new message
  • Body: initial message data
PUT /api/messages/:id -- Allows editing of a message
  • Body: updated message body
DELETE /api/messages/:id --Permanently deletes a message

Private Messages

GET /api/private-messages -- Returns private messages
POST /api/private-messages -- Creates a private message
  • Body: initial message data
PUT /api/private-messages/:id -- Edit a private message
  • Body: updated message body
DELETE /api/private-messages/:id -- Delete a private message
Clone this wiki locally