Skip to content

[WEB] mock up Stackoverflow features including Post a qustion, post an answer, upvoting and downvoting question and answer, and watch feature that track a specific question genre. Developed using Vuejs, Express, and Mongodb

Notifications You must be signed in to change notification settings

tyogautomo/questo-stackoverflow

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

Questo (simple web mocking up Stackoverflow)

API Documentation

All APIs using base URL:

http://localhost:3000

Deployed Web URL: http://questo.yogautomo.com

Index of Reference:

Screenshots

  1. Homepage Homepage
  2. Question Detail Question Detail

Users API

HTTP Endpoint Headers Body Description Reference
POST /users/signup none
username: string (required)
email: string (required)
password: string (required)
Register new user SignUp
POST /users/signin none
email: string (required)
password: string (required)
Login user SignIn
GET /users {JWT Token} none get authenticated user Get Authenticated User
PATCH /users/watch-tag {JWT Token} none set authenticated user's watched tags Set Watched Tags

Questions API

HTTP Endpoint Headers Body Description Reference
GET /questions none none get all questions Get Questions
GET /questions/:questionId none none get one question Get a Question
POST /questions {JWT Token}
title: string (required)
content: string (required)
tags: array (optional)
create question Create Question
PUT /questions/:questionId {JWT Token}
title: string (optional)
content: string (optional)
tags: array (optional)
update one question Update a Question
DELETE /questions/:questionId {JWT Token} none delete one question Delete a Question
POST /questions/upvote/:questionId {JWT Token} none upvote question Upvote a Question
POST /questions/downvote/:questionId {JWT Token} none downvote question Downvote a Question

Answers API

HTTP Endpoint Headers Body Description Reference
GET /answers/:questionId none none get related question's answers Get Question's Answers
POST /answers/:questionId {JWT Token}
content: string (required)
create answer Create Answer
DELETE /answers/:questionId/:answerId {JWT Token}
content: string (required)
get one answer Create Answer
GET /answers/find/:answerId {JWT Token} none get answers Get Answers
PUT /answers/:answerId {JWT Token}
content: string (required)
update answer Get Answers
POST /answers/upvote/:answerId {JWT Token} none upvote answer Upvote an Answer
POST /answers/downvote/:answerId {JWT Token} none downvote answer Downvote an Answer

Request & Response Details

Users

  • SignUp

    method: POST
    endpoint: /users/signup

    Request :

    • body:
      username: String, required
      email: String, required
      password: String, required

    Response :

    • 201
      {
          token: JWT Token,
          user: Object
      }
    • 400
      {
        "code": 400,
        "message": [
            "notNull Violation: Please input your username",
            "\nnotNull Violation: Please input your email"
        ]
      }
  • SignIn

    method: POST
    endpoint: /users/signin

    Request :

    • body:
      email: String, required
      password: String, required

    Response :

    • 200
      {
          token: JWT Token,
          user: Object
      }
    • 404
      {
        "code": 404,
        "message": "Wrong email / password"
      }
  • Get Authenticated User

    method: GET
    endpoint: /users

    Request :

    • body:
      none

    Response :

    • 200
      {
          username: String,
          email: String,
          password: String(hashed),
          upvotedQuestion: Array,
          downvotedQuestion: Array,
          upvotedAnswer: Array,
          downvotedAnswer: Array,
          watchedTags: Array
      }
    • 404
      {
        "code": 404,
        "message": "Not found"
      }
  • Set Watched Tags

    method: PATCH
    endpoint: /users/watch-tag

    Request :

    • body:
      {
          tags: Array
      }

    Response :

    • 200
      {
          username: String,
          email: String,
          password: String(hashed),
          upvotedQuestion: Array,
          downvotedQuestion: Array,
          upvotedAnswer: Array,
          downvotedAnswer: Array,
          watchedTags: Array // updated watched tags
      }

Questions

  • Get All Questions

    method: GET
    endpoint: /questions

    Request :

    • body:
      none

    Response :

    • 200
      [
          {
              title: String,
              content: String,
              tags: Array,
              answers: Array,
              userId: ObjectId,
              upVotes: Array,
              downVotes: Array,
              createdAt: Date,
              updatedAt: Date
          },
          ....
      ]
  • Get One Question

    method: GET
    endpoint: /questions/:questionId

    Request :

    • params:
      {
          questionId: String
      }

    Response :

    • 200
      {
          title: String,
          content: String,
          tags: Array,
          answers: Array,
          userId: ObjectId,
          upVotes: Array,
          downVotes: Array,
          createdAt: Date,
          updatedAt: Date
      }
    • 404
      {
          code: 404,
          message: 'Not found'
      }
  • Create Question

    method: GET
    endpoint: /questions/:questionId

    Request :

    • body:
      {
          title: String <required>,
          content: String <required>,
          tags: Array <optional>
      }
    • params:
      {
          questionId: String
      }
    • headers"
      {
          token: <JWT Token>
      }

    Response :

    • 201
      {
          title: String,
          content: String,
          tags: Array,
          answers: Array,
          userId: ObjectId,
          upVotes: Array,
          downVotes: Array,
          createdAt: Date,
          updatedAt: Date
      }
    • 400
      example:
      {
          code: 400,
          message: 'Title required'
      }
    • 401
      {
          code: 401,
          message: 'Unauthorized process'
      }
  • Update Question

    method: GET
    endpoint: /questions/:questionId

    Request :

    • body:
      {
          title: String <optional>,
          content: String <optional>,
          tags: Array <optional>
      }
    • params:
      {
          questionId: String
      }
    • headers"
      {
          token: <JWT Token>
      }

    Response :

    • 201
      "updated question"
      {
          title: String,
          content: String,
          tags: Array,
          answers: Array,
          userId: ObjectId,
          upVotes: Array,
          downVotes: Array,
          createdAt: Date,
          updatedAt: Date
      }
    • 400
      example:
      {
          code: 400,
          message: 'Title required'
      }
    • 401
      {
          code: 401,
          message: 'Unauthorized process'
      }
  • Delete Question

    method: DELETE
    endpoint: /questions/:questionId

    Request :

    • params:
      {
          questionId: String
      }
    • headers"
      {
          token: <JWT Token>
      }

    Response :

    • 201
      "deleted question"
      {
          title: String,
          content: String,
          tags: Array,
          answers: Array,
          userId: ObjectId,
          upVotes: Array,
          downVotes: Array,
          createdAt: Date,
          updatedAt: Date
      }
    • 404
      example:
      {
          code: 404,
          message: 'Not found'
      }
    • 401
      {
          code: 401,
          message: 'Unauthorized process'
      }
  • Upvote Question

    method: POST
    endpoint: /questions/upvote/:questionId

    Request :

    • params:
      {
          questionId: String
      }
    • headers"
      {
          token: <JWT Token>
      }

    Response :

    • 201
      "upvoted question"
      {
          title: String,
          content: String,
          tags: Array,
          answers: Array,
          userId: ObjectId,
          upVotes: Array,
          downVotes: Array,
          createdAt: Date,
          updatedAt: Date
      }
    • 404
      example:
      {
          code: 404,
          message: 'Not found'
      }
    • 401
      {
          code: 401,
          message: 'Unauthorized process'
      }
  • Upvote Question

    method: POST
    endpoint: /questions/downvote/:questionId

    Request :

    • params:
      {
          questionId: String
      }
    • headers"
      {
          token: <JWT Token>
      }

    Response :

    • 201
      "downvoted question"
      {
          title: String,
          content: String,
          tags: Array,
          answers: Array,
          userId: ObjectId,
          upVotes: Array,
          downVotes: Array,
          createdAt: Date,
          updatedAt: Date
      }
    • 404
      example:
      {
          code: 404,
          message: 'Not found'
      }
    • 401
      {
          code: 401,
          message: 'Unauthorized process'
      }

Answers

  • Get Related Question's Answers

    method: GET
    endpoint: /answers/:questionId

    Request :

    • params:
      {
          questionId: String
      }

    Response :

    • 200
      [
          {
              content: String,
              userId: ObjectId,
              questionId: ObjectId,
              upVotes: Array,
              downVotes: Array,
              createdAt: Date,
              updatedAt: Date
          },
          ...
      ]
  • Create Answers

    method: POST
    endpoint: /answers/:questionId

    Request :

    • params:
      {
          questionId: String
      }
    • headers:
      {
          token: <JWT Token>
      }

    Response :

    • 201
      {
          content: String,
          userId: ObjectId,
          questionId: ObjectId,
          upVotes: Array,
          downVotes: Array,
          createdAt: Date,
          updatedAt: Date
      }
    • 400
      {
          code: 400,
          message: 'Content required'
      }
    • 401
      {
          code: 401,
          message: 'Unauthorized process'
      }
  • Delete Answers

    method: DELETE
    endpoint: /answers/:questionId/:answerId

    Request :

    • params:
      {
          questionId: String,
          answerId: String
      }
    • headers:
      {
          token: <JWT Token>
      }

    Response :

    • 200
      "deleted answer"
      {
          content: String,
          userId: ObjectId,
          questionId: ObjectId,
          upVotes: Array,
          downVotes: Array,
          createdAt: Date,
          updatedAt: Date
      }
    • 404
      {
          code: 404,
          message: 'Not found'
      }
    • 401
      {
          code: 401,
          message: 'Unauthorized process'
      }
  • Get One Answers

    method: GET
    endpoint: /answers/:answerId

    Request :

    • params:
      {
          answerId: String
      }
    • headers:
      {
          token: <JWT Token>
      }

    Response :

    • 200
      {
          content: String,
          userId: ObjectId,
          questionId: ObjectId,
          upVotes: Array,
          downVotes: Array,
          createdAt: Date,
          updatedAt: Date
      }
    • 404
      {
          code: 404,
          message: 'Not found'
      }
    • 401
      {
          code: 401,
          message: 'Unauthorized process'
      }
  • Update Answers

    method: DELETE
    endpoint: /answers/:answerId

    Request :

    • params:
      {
          answerId: String
      }
    • headers:
      {
          token: <JWT Token>
      }
    • body:
      {
          content: String <required>
      }

    Response :

    • 200
      "updated answer"
      {
          content: String,
          userId: ObjectId,
          questionId: ObjectId,
          upVotes: Array,
          downVotes: Array,
          createdAt: Date,
          updatedAt: Date
      }
    • 404
      {
          code: 404,
          message: 'Not found'
      }
    • 401
      {
          code: 401,
          message: 'Unauthorized process'
      }
  • Upvote Answers

    method: POST
    endpoint: /answers/upvote/:answerId

    Request :

    • params:
      {
          answerId: String
      }
    • headers:
      {
          token: <JWT Token>
      }

    Response :

    • 200
      "upvoted answer"
      {
          content: String,
          userId: ObjectId,
          questionId: ObjectId,
          upVotes: Array,
          downVotes: Array,
          createdAt: Date,
          updatedAt: Date
      }
    • 404
      {
          code: 404,
          message: 'Not found'
      }
    • 401
      {
          code: 401,
          message: 'Unauthorized process'
      }
  • Downvote Answers

    method: POST
    endpoint: /answers/downvote/:answerId

    Request :

    • params:
      {
          answerId: String
      }
    • headers:
      {
          token: <JWT Token>
      }

    Response :

    • 200
      "downvoted answer"
      {
          content: String,
          userId: ObjectId,
          questionId: ObjectId,
          upVotes: Array,
          downVotes: Array,
          createdAt: Date,
          updatedAt: Date
      }
    • 404
      {
          code: 404,
          message: 'Not found'
      }
    • 401
      {
          code: 401,
          message: 'Unauthorized process'
      }

About

[WEB] mock up Stackoverflow features including Post a qustion, post an answer, upvoting and downvoting question and answer, and watch feature that track a specific question genre. Developed using Vuejs, Express, and Mongodb

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Vue 50.9%
  • JavaScript 48.3%
  • HTML 0.8%