Forum App
Forum App is an app where users can ask questions, get answers, comments, replies and more. User can also upvote and downvote questions and answers in the application. It is similar to Quora or Stackoverflow application.
#
Auth RoutesIn Forum App
, the authentication is done with username
and password
credential fields.
You can refer documentation related to Authentication here
#
User RoutesThe following Routes are relating to Users. Below are Publicly accessible routes.
/api/users
#
1. GET Request URL:
/api/users
HTTP Method: GET
Response Body:
{ data: { users: Array; }}
Functionality: This API call gets all users from the db.
/api/users/:userId
#
2. GET Request URL:
/api/users/:userId
HTTP Method: GET
Response Body:
{ data: { user: Object; }}
Functionality: This API call gets a particular user from the db.
Below are Privately accessible routes.
/api/users/edit
#
3. POST Request URL:
/api/users/edit
HTTP Method: POST
Request Headers:
authorization: encodedToken
Request Body:
{ userData;}
Response Body:
{ data: { user: Object; }}
Functionality: This API call edits a user to the db.
/api/users/follow/:followUserId
#
4. POST Request URL:
/api/users/follow/:followUserId
HTTP Method: POST
Request Headers:
authorization: encodedToken
Request Body: {}
Response Body:
{ data: { user: Object; followUser: Object; }}
Functionality: This API call is responsible for follow action by the user.
/api/users/unfollow/:followUserId
#
5. POST Request URL:
/api/users/unfollow/:followUserId
HTTP Method: POST
Request Headers:
authorization: encodedToken
Request Body: {}
Response Body:
{ data: { user: Object, followUser: Object }}
Functionality: This API call is responsible for unfollow action by the user.
#
Questions RoutesThe following Routes are relating to Questions. Below are Publicly accessible routes.
/api/questions
#
1. GET Request URL:
/api/questions
HTTP Method: GET
Response Body:
{ data: { questions: Array; }}
Functionality: This API call gets all questions from the db.
/api/questions/:questionId
#
2. GET Request URL:
/api/questions/:questionId
HTTP Method: GET
Response Body:
{ data: { question: Object; }}
Functionality: This API call gets a particular question from the db.
/api/questions/:username
#
3. GET Request URL:
/api/questions/:username
HTTP Method: GET
Response Body:
{ data: { questions: Array; }}
Functionality: This API call gets all questions by username from the db.
Below are Privately accessible routes.
/api/questions/add
#
4. POST Request URL:
/api/questions/add
HTTP Method: POST
Request Headers:
authorization: encodedToken
Request Body:
{ questionData;}
Response Body:
{ data: { questions: Array; }}
Functionality: This API call adds a question to the db.
/api/questions/edit/:questionId
#
5. POST Request URL:
/api/questions/edit/:questionId
HTTP Method: POST
Request Headers:
authorization: encodedToken
Request Body:
{ questionData;}
Response Body:
{ data: { questions: Array; }}
Functionality: This API call edits a question in the db.
/api/questions/delete/:questionId
#
6. DELETE - Request URL:
/api/questions/delete/:questionId
- HTTP Method: DELETE
- Request Headers:
authorization: encodedToken
- Response Body:
{ data: { questions: Array; }}
- Functionality: This API call deletes a question in the db.
#
Answer RoutesThe following Routes are relating to Answers. Below are Publicly accessible routes.
/api/answers/:questionId
#
1. GET Request URL:
/api/answers/:questionId
HTTP Method: GET
Response Body:
{ data: { answers: Array; }}
Functionality: This API call gets all answers of a particular question from the db.
Below are Privately accessible routes.
/api/answers/add/:questionId
#
2. POST Request URL:
/api/answers/add/:questionId
HTTP Method: POST
Request Headers:
authorization: encodedToken
Request Body:
{ answerData;}
Response Body:
{ data: { answers: Array; }}
Functionality: This API call adds an answer to the question in the db.
/api/answers/edit/:questionId/:answerId
#
3. POST Request URL:
/api/answers/edit/:questionId/:answerId
HTTP Method: POST
Request Headers:
authorization: encodedToken
Request Body:
{ answerData;}
Response Body:
{ data: { answers: Array; }}
Functionality: This API call edits an answer of the question in the db.
/api/answers/delete/:questionId/:answerId
#
4. DELETE Request URL:
/api/answers/edit/:questionId/:answerId
HTTP Method: POST
Request Headers:
authorization: encodedToken
Response Body:
{ data: { answers: Array; }}
Functionality: This API call deletes an answer of the question in the db.
#
Votes RoutesThe following Routes are relating to Votes. Below are Publicly accessible routes.
/api/votes/:questionId
#
1. GET Request URL:
/api/votes/:questionId
HTTP Method: GET
Response Body:
{ data: { votes: Array; }}
Functionality: This API call gets all votes of a question from the db.
/api/votes/:questionId/:answerId
#
2. GET Request URL:
/api/votes/:questionId/:answerId
HTTP Method: GET
Response Body:
{ data: { votes: Array; }}
Functionality: This API call gets all votes of an answer to a question from the db.
Below are Privately accessible routes.
/api/votes/react/:questionId
#
3. POST Request URL:
/api/votes/react/:questionId
HTTP Method: POST
Request Body:
{ vote: { reaction: "upvote" | "unvote" | "downvote"; }}
Response Body:
{ data: { votes: Array; }}
Functionality: This API call reacts to a question from the db.
/api/votes/react/:questionId/:answerId
#
4. POST Request URL:
/api/votes/react/:questionId/:answerId
HTTP Method: POST
Request Body:
{ vote: { reaction: "upvote" | "unvote" | "downvote"; }}
Response Body:
{ data: { votes: Array; }}
Functionality: This API call reacts to an answer of a question from the db.
#
Comment RoutesThe following Routes are relating to Comments. Below are Publicly accessible routes.
/api/comments/:questionId
#
1. GET Request URL:
/api/comments/:questionId
HTTP Method: GET
Response Body:
{ data: { comments: Array; }}
Functionality: This API call gets all comments of a question from the db.
/api/comments/:questionId/:answerId
#
2. GET Request URL:
/api/comments/:questionId
HTTP Method: GET
Response Body:
{ data: { comments: Array; }}
Functionality: This API call gets all comments of an answer to a question from the db.
Below are Privately accessible routes.
/api/comments/add/:questionId
#
3. POST Request URL:
/api/comments/add/:questionId
HTTP Method: POST
Request Body:
{ commentData;}
Response Body:
{ data: { comments: Array; }}
Functionality: This API call adds a comment to question from the db.
/api/comments/edit/:questionId/:commentId
#
4. POST Request URL:
/api/comments/edit/:questionId/:commentId
HTTP Method: POST
Request Body:
{ commentData;}
Response Body:
{ data: { comments: Array; }}
Functionality: This API call edits a comment to question from the db.
/api/comments/delete/:questionId/:commentId
#
5. DELETE Request URL:
/api/comments/delete/:questionId/:commentId
HTTP Method: DELETE
Response Body:
{ data: { comments: Array; }}
Functionality: This API call deletes a comment of a question from the db.
/api/comments/add/:questionId/:answerId
#
6. POST Request URL:
/api/comments/add/:questionId/:answerId
HTTP Method: POST
Request Body:
{ commentData;}
Response Body:
{ data: { comments: Array; }}
Functionality: This API call adds a comment to an answer of a question from the db.
/api/comments/edit/:questionId/:answerId/:commentId
#
7. POST Request URL:
/api/comments/edit/:questionId/:answerId/:commentId
HTTP Method: POST
Request Body:
{ commentData;}
Response Body:
{ data: { comments: Array; }}
Functionality: This API call edits a comment to an answer of a question from the db.
/api/comments/delete/:questionId/:answerId/:commentId
#
8. POST Request URL:
/api/comments/delete/:questionId/:answerId/:commentId
HTTP Method: DELETE`
Response Body:
{ data: { comments: Array; }}
Functionality: This API call deletes a comment to an answer of a question from the db.