8000 GitHub - miriam-16/WhatDoYouMeme: "What Do You Meme" Card Game Web Version
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

miriam-16/WhatDoYouMeme

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Review Assignment Due Date

Exam #1: "Meme Game"

Student: s332135 LAMARI MIRIAM

React Client Application Routes

  • 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.

Main React Components

  • MainComponent (in MainComponent.jsx): Used to manage login and starting the game;
  • LoginForm in (LoginForm.jsx): Used to show the login form, accessible by MainComponent;
  • HeaderComponent (in HeaderComponent.jsx): Used to show the header of the page. It allows to navigate to MainComponent, HistoryComponent (see below) and to logout;
  • GameComponent (in GameComponent.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 (in HistoryComponent.jsx): Used to show the history of the games played of the logged user;
  • ResultsPage (in ResultsPage.jsx): Used to show the results of the game just finished.

API Server

  • 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
  • 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
[
  {
    "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
    • response body content [15,16]
    • response status codes and possible errors
      • 200 OK
      • 500 Internal Server Error
  • 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

Database Tables

  • 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.

Screenshots

Screenshot1

Screenshot2

Users Credentials

About

"What Do You Meme" Card Game Web Version

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0