You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Route /login: login page triggered by non-authenticated users by clicking on a login button placed on the Navbar
Route /public: it is the home page for non-logged-in users. It shows public memes
Route /private: it is the home page for logged-in users. It shows publicandpeivate memes
Route /add: page to add a new meme from scratch. It is linked to the add-button showed on the private page so that only logged-in users can add new memes
API Server
Meme management
Get public memes
HTTP method: GET URL: /api/memes
Description: Get the full list of memes or just the public ones
Request body: None
Request query parameter: None
Request example:
GET http://localhost:3001/api/memesContent-type: text/plain
Response: 200 OK (success)
Response body: Array of objects, each describing a meme:
Error responses: 500 Internal Server Error (generic error)
Add a new meme
HTTP method: POST URL: /api/memes
Description: Add a new meme
Request body: JSON description of the object to be added (meme id i.e., mID is not required and would be ignored because the DB automatically manages the IDs)
Response body: the object as represented in the database
Error responses:
422 Unprocessable Entity (values do not satisfy validators) 503 Service Unavailable (database error) 401 Unauthorized (for non-logged-in users)
Add a new sentence
HTTP method: POST URL: /api/memes
Description: Add a new sentence row in the DB
Request body: JSON description of the object to be added (sentence id i.e., sID is not required and would be ignored because the DB automatically manages the IDs)
Login (in Login.js): it provides a modal to provide user's credentials, and it handles the login phase
LoginButton (in Login.js): it links to the /login Route where the Login component will be fetched
LogoutButton (in Login.js): onClick it triggers the logout
ModalAddOrCopy (in ModalAddOrCopy.js): it is a Form within a Modal that appears whenever a new meme has to be built
starting from an image (i.e., from scratch in the add) or starting from another meme. The Form must be filled with the meme
properties ad has to respect some constraints.
MyNavbar (in MyNavbar.js): it is the navbar of the site. It is the place where the login/logout button appears
NewMeme (in NewMeme.js): it is rendered in the add Route. This component displays the list of images from which
start a new meme creation
ClickableImage (in NewMeme.js): the images cited above are made clickable by this component which embeds the ModalAddOrCopy
within them
PrivatePage (in PrivatePage.js): it is rendered in the /private Route and renders the list of both public and
private memes. It shows the add button too
PrivateMeme (in PrivateMeme.js): it builds the private memes. Furthermore, this component embeds within the memes
loaded by PrivatePage the Delete, and the Copy functions. The latter exploits the ModalAddOrCopy which is triggered
by the Copy button
PublicPage (in PublicPage.js): like PrivatePage but only for public memes and without the add button. Rendered
in the /public Route
ShowProperties (in ShowProperties.js): each public meme once clicked shows a modal with its properties.
This component defines that modal
PublicMeme (in PublicMeme.js): this component builds the public meme and its properties to be shown through
ShowProperties component