All APIs using base URL:
http://localhost:3000
Deployed Web URL: http://questo.yogautomo.com
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 |
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 |
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 |
-
method:
POST
endpoint:/users/signup
- body:
username: String, required email: String, required password: String, required
- 201
{ token: JWT Token, user: Object }
- 400
{ "code": 400, "message": [ "notNull Violation: Please input your username", "\nnotNull Violation: Please input your email" ] }
- body:
-
method:
POST
endpoint:/users/signin
- body:
email: String, required password: String, required
- 200
{ token: JWT Token, user: Object }
- 404
{ "code": 404, "message": "Wrong email / password" }
- body:
-
method:
GET
endpoint:/users
- body:
none
- 200
{ username: String, email: String, password: String(hashed), upvotedQuestion: Array, downvotedQuestion: Array, upvotedAnswer: Array, downvotedAnswer: Array, watchedTags: Array }
- 404
{ "code": 404, "message": "Not found" }
- body:
-
method:
PATCH
endpoint:/users/watch-tag
- body:
{ tags: Array }
- 200
{ username: String, email: String, password: String(hashed), upvotedQuestion: Array, downvotedQuestion: Array, upvotedAnswer: Array, downvotedAnswer: Array, watchedTags: Array // updated watched tags }
- body:
-
method:
GET
endpoint:/questions
- body:
none
- 200
[ { title: String, content: String, tags: Array, answers: Array, userId: ObjectId, upVotes: Array, downVotes: Array, createdAt: Date, updatedAt: Date }, .... ]
- body:
-
method:
GET
endpoint:/questions/:questionId
- params:
{ questionId: String }
- 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' }
- params:
-
method:
GET
endpoint:/questions/:questionId
- body:
{ title: String <required>, content: String <required>, tags: Array <optional> }
- params:
{ questionId: String }
- headers"
{ token: <JWT Token> }
- 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' }
- body:
-
method:
GET
endpoint:/questions/:questionId
- body:
{ title: String <optional>, content: String <optional>, tags: Array <optional> }
- params:
{ questionId: String }
- headers"
{ token: <JWT Token> }
- 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' }
- body:
-
method:
DELETE
endpoint:/questions/:questionId
- params:
{ questionId: String }
- headers"
{ token: <JWT Token> }
- 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' }
- params:
-
method:
POST
endpoint:/questions/upvote/:questionId
- params:
{ questionId: String }
- headers"
{ token: <JWT Token> }
- 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' }
- params:
-
method:
POST
endpoint:/questions/downvote/:questionId
- params:
{ questionId: String }
- headers"
{ token: <JWT Token> }
- 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' }
- params:
-
method:
GET
endpoint:/answers/:questionId
- params:
{ questionId: String }
- 200
[ { content: String, userId: ObjectId, questionId: ObjectId, upVotes: Array, downVotes: Array, createdAt: Date, updatedAt: Date }, ... ]
- params:
-
method:
POST
endpoint:/answers/:questionId
- params:
{ questionId: String }
- headers:
{ token: <JWT Token> }
- 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' }
- params:
-
method:
DELETE
endpoint:/answers/:questionId/:answerId
- params:
{ questionId: String, answerId: String }
- headers:
{ token: <JWT Token> }
- 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' }
- params:
-
method:
GET
endpoint:/answers/:answerId
- params:
{ answerId: String }
- headers:
{ token: <JWT Token> }
- 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' }
- params:
-
method:
DELETE
endpoint:/answers/:answerId
- params:
{ answerId: String }
- headers:
{ token: <JWT Token> }
- body:
{ content: String <required> }
- 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' }
- params:
-
method:
POST
endpoint:/answers/upvote/:answerId
- params:
{ answerId: String }
- headers:
{ token: <JWT Token> }
- 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' }
- params:
-
method:
POST
endpoint:/answers/downvote/:answerId
- params:
{ answerId: String }
- headers:
{ token: <JWT Token> }
- 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' }
- params: