API - Messages
File Name: messages.js
File Path: /server/routes/messages.js
This route is used to handle user's chat (messages) related queries. For example: fetching favourite users and messages, fetching specific user messages.
- Contents:
- fetching favourite users and messages
- fetching specific user messages
All User Details
- API Path: api/messages/usersMessages
- Method: GET
- Description:
- This route fetch favourite users and messages, those which are registered with the vChatApp application.
- Renders paginated data.
- Functionality:
./controllers/messages.js
Parameters:
- Name: req
- Type: Object
Name Type Required token string true Description: Response object returned to the api which contains favourite users and messages.
Response:
- Returns object with four properties: success (bool), message , data and meta .
Data field is an array of favourite users and messages object containing all the details perivious chat and messages.
Http Code: 200
Name: returnObj
Type: array
fetching specific user messages
- API Path: api/messages/?id=${receiverID}
- Method: GET
- Description:
- This route fetch userSppecific messages
- Functionality:
./controllers/messages.js
Parameters:
Name req type object Contains Authorization: token Name: res
Type: Object
Description: Response object returned to the api which contains object of messages.
Response:
- Returns object with three properties: success(bool), message and data
Data : field is an object containing the details of requested user.
Http Code: 200
Name: returnObj
Type: Object