React Client Application Routes
- Route
/
: Main Page
- Route
/MyInfo
: Users' pushlished riddles
- Route
/rankinng
: Users' ranking
- Route
/add
: Add new Riddle
= Route /login
"Login Page
- Default Route: No page found
- GET
/api/history/:rid
- return the corresponding history by riddle id
- request header: rid
- request body : none
- response:
200 OK
(success), 500 Internal Server Error
(generic error)
- response body: A History
[
{
"hid": 3,
"rid": 12,
"repId": 4,
"answerTime": "2021/12/20 09:33:44",
"answer": "NOON",
"result": "T"
},
...
]
- POST
/api/history
- request parameters and body :The reply wait for saving in database
- response body :
200 OK
(success),500 Internal Server Error
(generic error)
{
"rid": 1,
"repId": 5,
"answerTime": "syring",
"answer": "giraffe"
}
- GET
/api/riddles
- return all riddles
- request header: none
- request body : none
- response:
200 OK
(success), 500 Internal Server Error
(generic error)
- response body: All riddles
[
{
"rid": 1,
"content": "The height of my legs—usually around 6 feet—is taller than most humans. What animal am I?",
"difficulty": "easy",
"hint1": "h11",
"hint2": "h12",
"duration": 30,
"state": "open",
"answer": "giraffe",
"createTime": "2021/1/29 09:33:11",
"closeTime": "",
"expiration": "",
"authorId": 1
},
...
]
- GET
/api/riddles/:state
- request parameters : state(with authorized)
- response body : all open riddles
[
{
"rid": 1,
"content": "The height of my legs—usually around 6 feet—is taller than most humans. What animal am I?",
"difficulty": "easy",
"hint1": "h11",
"hint2": "h12",
"duration": 30,
"state": "open",
"answer": "giraffe",
"createTime": "2021/1/29 09:33:11",
"closeTime": "",
"expiration": "",
"authorId": 1
},
...
]
- GET
/api/riddles/:uid
- request parameters : authorId(with authorized)
- response body : the riddles created by the current authorId
- POST
/api/riddle
- request parameters : no
- request body: Riddle
- response :
200 OK
(success), 500 Internal Server Error
(generic error)
{
"content": "test1",
"difficulty": "t1",
"hint1": "h11",
"hint2": "h12",
"duration": 30,
"state": "open",
"answer": "giraffe",
"createTime": "2021/1/29 09:33",
"closeTime": "",
"authorId": 1
}
Update Riddle state by its riddleId
- PUT
/api/riddle/state/:rid
- request parameters : riddle Id
- request body: riddle new state
- response :
200 OK
(success), 500 Internal Server Error
(generic error)
Get a user's info(only name and points) By UserId
- GET
/api/user/:id
- request parameters: userId to retrive user's information
- GET
/api/session/current
- response body : session information (userId, name, password...)
Delete a user's information
- DELETE
/api/session/current
Post a user's information
- Get
/api/users
- Get all user's necessary by order for Ranking
- Table
users
- id
- name
- surname
- email
- password
- salt
- points
- Table
History
- hid
- rid
- repId
- answerTime
- answer
- result(T/F)
- Table
Riddle
- rid
- content
- difficulty
- hint1
- hint2
- duration
- state
- answer
- ceateTime
- closeTime
- expiration
- authorId
ClosedRiddlesTable
(in MyRiddlesTable.js
): For rendering all closed riddles which created by current user
MyOpenRiddlesTable
(in MyRiddlesTable.js
): For displaying all ongoing riddles which created by current user
OpenRiddlesTable
(in LoginRiddlesTable.js
): For showing all onging riddles, and allow user to try
RiddleForm
: For adding the new riddle