- Route
/
: Main page of the application. It allows to login or to start a game. - Route
/game
: Page of the started game. - Route
/game/results
: Show the results of the game just finished. It is visible only for games of three rounds. - Route
/history
: Show the history of the games played of the logged user.
MainComponent
(inMainComponent.jsx
): Used to manage login and starting the game;LoginForm
in (LoginForm.jsx
): Used to show the login form, accessible by MainComponent;HeaderComponent
(inHeaderComponent.jsx
): Used to show the header of the page. It allows to navigate to MainComponent, HistoryComponent (see below) and to logout;GameComponent
(inGameComponent.jsx
): Used to manage rounds of a game. Fetch the memes from the server and store the results of the game, showed in ResultsPage (see below);HistoryComponent
(inHistoryComponent.jsx
): Used to show the history of the games played of the logged user;ResultsPage
(inResultsPage.jsx
): Used to show the results of the game just finished.
- POST
/api/sessions
: Authenticate a user- request parameters and request body content:
{ "email": "mariorossi@gmail.com", "password": "password1" }
- response body content:
{ "id": 1, "email": "mariorossi@gmail.com", "name": "Mario" }
- response status codes and possible errors:
- 201: Created
- 401: Unauthorized
- 500: Internal Server Error
- request parameters and request body content:
- GET
/api/sessions/current
: Retrieve user session if still up- request parameters
- response body content
- response status codes and possible errors:
- 200: OK
- 401 Unauthorized
- DELETE
api/sessions/current
: log out user- request parameters and request body content
- response body content
- response status codes and possible errors
- 500: Internal Server Error
- GET
/api/memes
: Get the memes to be used in the game- request parameters: query
count
- response body content
- request parameters: query
[
{
"id": 1,
"meme": "./public/meme1.jpg",
"captions": [
{ "id": 35, "caption": "Caption caption 35" },
{ "id": 2, "caption": "Caption caption 2" },
{ "id": 48, "caption": "Caption caption 48" },
{ "id": 19, "caption": "Caption caption 19" },
{ "id": 41, "caption": "Caption caption 41" },
{ "id": 45, "caption": "Caption caption 45" },
{ "id": 1, "caption": "Caption caption 1" }
]
},
{
"id": 2,
"meme": "./public/meme2.png",
"captions": [
{ "id": 49, "caption": "Caption caption 49" },
{ "id": 26, "caption": "Caption caption 26" },
{ "id": 19, "caption": "Caption caption 19" },
{ "id": 24, "caption": "Caption caption 24" },
{ "id": 4, "caption": "Caption caption 4" },
{ "id": 22, "caption": "Caption caption 22" },
{ "id": 3, "caption": "Caption caption 3" }
]
},
{
"id": 5,
"meme": "./public/meme5.jpg",
"captions": [
{ "id": 19, "caption": "Caption caption 19" },
{ "id": 22, "caption": "Caption caption 22" },
{ "id": 11, "caption": "Caption caption 11" },
{ "id": 9, "caption": "Caption caption 9" },
{ "id": 47, "caption": "Caption caption 47" },
{ "id": 13, "caption": "Caption caption 13" },
{ "id": 10, "caption": "Caption caption 10" }
]
}
]
-
response status codes and possible errors:
- 200 OK
- 422 Unprocessable Entity
- 500 Internal Server Error
-
GET
/api/memes/verify/:memeId
: Check the correct answers for the current meme- request parameters and request body content
- Request parameter:
memeId
- Request parameter:
- response body content
[15,16]
- response status codes and possible errors
- 200 OK
- 500 Internal Server Error
- request parameters and request body content
-
POST
/api/game
: Store the game just finished- request parameters and request body content
{ "savedRounds": [ { "roundN": 1, "meme": 4, "selectedCaption": 8, "point": 5 }, { "roundN": 2, "meme": 8, "selectedCaption": 15< 7377 /span>, "point": 5 }, { "roundN": 3, "meme": 11, "selectedCaption": 0, "point": 0 } ] }
- response body content
{ id: gameId }
- response status codes and possible errors
- 200 OK
- 422 Unprocessable Entity
- 500 Internal Server Error
-
GET
/api/history
: Get the history of the games played by the logged user- request parameters
- response body content
{ "games": [ { "gameId": 9, "gameDate": "2024-06-26T19:51:33", "rounds": [ { "roundId": 55, "memeUrl": "./public/meme8.png", "points": 5 }, { "roundId": 54, "memeUrl": "./public/meme11.jpg", "points": 0 }, { "roundId": 53, "memeUrl": "./public/meme4.jpg", "points": 5 } ], "totalGamePoints": 10 }, { "gameId": 8, "gameDate": "2024-06-26T19:04:15", "rounds": [ { "roundId": 52, "memeUrl": "./public/meme10.jpg", "points": 5 }, { "roundId": 51, "memeUrl": "./public/meme7.jpg", "points": 0 }, { "roundId": 50, "memeUrl": "./public/meme4.jpg", "points": 0 } ], "totalGamePoints": 5 } ], "totalPoints": 55 }
- response status codes and possible errors
- 200 OK
- 500 Internal Server Error
- Table
user
- used to memorize the name, email and password of the users - Table
meme
- used to store the memes - Table
caption
- used to store the captions that might be associated to the memes - Table
meme_caption
- used to store the association between memes and captions - Table
round
- used to store the information about a game round, as the points, the meme and the caption chosen by the user, as well as the points obtained. - Table
game
- used to store the games played by the users.
- username: eduard.doe@polito.it; password: password2 (this user has some games played)
- username: luca@polito.it; password: password1 (no games played)