npm install
npm run serve
npm run build
npm run lint
Currently run on http://localhost:3000
User routes:
Route | HTTP | Header(s) | Body | Description | Response |
---|---|---|---|---|---|
user/register | POST | none | name, email, password | Register new uer | (201) Success, (400) Validate error |
user/login | POST | none | email, password | Normal login with jwt | (200) Success, (404) Not Found, need register |
user/google | POST" | none | id_token | Login with google account | (200) Success, (500) Server Error |
Question routes:
Route | HTTP | Header(s) | Body | Description | Response |
---|---|---|---|---|---|
/question | GET | none | none | Get all question list | (200) Success, (404) no data |
/question/:id | GET | none | none | Get one specific question | (200) Success, (500) server error |
/question/my-question/:id | GET | usertoken | none | Get all user's question | (200) OK, (500) server error |
/question/:id | DELETE | userToken | none | Delete one specific user's question | (200) OK, (403) not authorize |
/question | POST | usertoken | {title, content} | Add new question | (201) OK, (500) server error |
/question/:id | PUT | usertoken | {title, content} | Edit one specific question | (200) OK, (500) server error |
/question/upvote/:id | PATCH | usertoken | none | PATCH upvote | (200) OK, (500) server error |
/question/downvote/:id | PATCH | usertoken | none | PATCH downvote | (200) OK, (500) server error |
/question/clicks/:id | PATCH | usertoken | none | PATCH question views | (200) OK, (500) server error |
Answer routes:
Route | HTTP | Header(s) | Body | Description | Response |
---|---|---|---|---|---|
/answer/:id | GET | none | none | Get all specific question's answer | (200) OK, (403) not authorize |
/answer/:id | POST | userToken | {content} | Add answer to one question | (201) OK, (403) not authorize |
/answer/:id | *PUT | userToken | none | Update a question's answer | (200) OK, (403) not authorize |
/answer/upvote/:id | PATCH | userToken | none | Patch upvote for answer | (200) OK, (403) server error |
/answer/downvote/:id | PATCH | userToken | none | Patch downvote for answer | (200) OK, (403) not authorize |
$ npm install
$ npm start
$ npm run dev