Global

Methods

# route /api/browseContent()

Route:
MethodPath
GET /api/browseContent?page
Returns a page of content IDs for a given search
Query Parameters:
Name Type Description
page number The page that the data is being fetched for. Offsets the result from the database
count number The number of IDs to fetch from the database, aka, the number of items per page
sortBy String Determines how the resulting items will be sorted. Options include "Downloads" and "UpdatedDate"
tags String A series of comma-separated tags that will narrow the search
searchString String A series of terms that will be used in a full-text search on content titles and descriptions

View Source server/qrs/queries.js, line 177

An array of content IDs or a string containing an error message

# route /api/commentCount/:ContentID()

Route:
MethodPath
GET /api/commentCount/:ContentID
Gets the total number of comments left on a piece of content
Route Parameters:
Name Type Description
:ContentID String The ID of a piece of content

View Source server/qrs/queries.js, line 429

An object containing the number of items at key count or a string containing an error message

# route /api/comments/:ContentID()

Route:
MethodPath
GET /api/comments/:ContentID?page
Fetchs a page of comments left on a piece of content
Query Parameters:
Name Type Description
page number The page that the data is being fetched for. Offsets the result from the database
count number The number of comments to fetch from the database, aka, the number of items per page
Route Parameters:
Name Type Description
:ContentID String The ID of a piece of content

View Source server/qrs/queries.js, line 402

An array of comment data or a string containing an error message

# route /api/contentCard/:ContentID()

Route:
MethodPath
GET /api/contentCard/:ContentID
Retrieves the data for the ContentCard component on the frontend
Route Parameters:
Name Type Description
:ContentID String The unique ID of a piece of uploaded content

View Source server/qrs/queries.js, line 87

An object containing the content details or a string with an error message

# route /api/contentDetails/:ContentID()

Route:
MethodPath
GET /api/contentDetails/:ContentID
Retrieves the data for the ContentDetails component on the frontend
Route Parameters:
Name Type Description
:ContentID String The unique ID of a piece of uploaded content

View Source server/qrs/queries.js, line 72

An object containing the content details or a string with an error message

# route /api/contentUpload()

Route:
MethodPath
POST /api/contentUpload
Uploads a new piece of content to MongoDB
Authentication

The user's login token from their localstorage

Body Parameters:
Name Type Description
AuthorEmail String The email of the content's creator
ContentType String The type of content being uploaded. Only "map" is supported right now
Title String The title of the content
Description String The description of the content
Tags Array. An array of tags that can be used to find this content in the browser
FileData String A base64 representation of the uploaded file
ThumbnailData String A base64 representation of the thumbnail photo
Header Parameters:
Name Type Description
Content-Type String The type of data contained in the body. Should be application/json
Authorization String The local token that proves the user is signed in
To Do:
  • Ideally, this should probably use formdata or a dedicated service for uploading files
  • It also needs better error handling so the document is removed if a problem occurs or if body params are gone

View Source server/qrs/queries.js, line 102

A string containing the ID of the uploaded content or an error if something went wrong

# route /api/countContent()

Route:
MethodPath
GET /api/countContent?&tags
Counts the total number of items that fit a certain search filter
Query Parameters:
Name Type Description
tags String A series of comma-separated tags that will narrow the search
searchString String A series of terms that will be used in a full-text search on content titles and descriptions

View Source server/qrs/queries.js, line 237

An object containing the number of items at key count or a string containing an error message

# route /api/countProfileContent()

Route:
MethodPath
GET /api/countProfileContent/:Username
Counts the pieces of content uploaded by a certain user
Route Parameters:
Name Type Description
:Username String The user's username

View Source server/qrs/queries.js, line 274

An object containing the number of items at key count or a string containing an error message

# route /api/fullprofile/:Username()

Route:
MethodPath
GET /api/fullprofile/:Username
Retrieves the data for the ProfileCard component on the frontend
Route Parameters:
Name Type Description
:Username String The user's username

View Source server/qrs/queries.js, line 299

An object containing the profile data or a string containing an error message

# route /api/getEmail/:Username()

Route:
MethodPath
GET /api/getEmail/:Username
Gets the user's email from their username. A temporary solution
Route Parameters:
Name Type Description
:Username String The user's username

View Source server/qrs/queries.js, line 316

An object containing the email at key email or a string containing an error message

# route /api/login()

Route:
MethodPath
POST /api/login
Generates an authentication token for a user if they provide correct login details
Authentication

The user's login token from their localstorage

Body Parameters:
Name Type Description
username String The user's username
password String The user's password
Header Parameters:
Name Type Description
Content-Type String The type of data contained in the body. Should be application/json
To Do:
  • This will need huge security improvements if this is going to run in prod
  • We can't just send plaintext passwords in a real website!

View Source server/qrs/login.js, line 13

An object containing the token at key token or a string containing an error message

# route /api/newComment/:ContentID()

Route:
MethodPath
POST /api/newComment/:ContentID
Posts a new comment of a piece of content
Authentication

The user's login token from their localstorage

Body Parameters:
Name Type Description
username String The username of the person leaving the rating
text String The text content of the comment
Header Parameters:
Name Type Description
Content-Type String The type of data contained in the body. Should be application/json
Authorization String The local token that proves the user is signed in
Route Parameters:
Name Type Description
:ContentID String The ID of a piece of content
To Do:
  • Give a proper message instead of returning the DB row
  • Properly check if the body params are fulfilled

View Source server/qrs/queries.js, line 366

The inserted row into the database or a string containing an error message

# route /api/protected()

Route:
MethodPath
/api/protected
Used to test the token authentication system
Authentication

The user's login token from their localstorage

Header Parameters:
Name Type Description
Content-Type String The type of data contained in the body. Should be application/json
Authorization String The local token that proves the user is signed in

View Source server/qrs/login.js, line 55

A string containing a message that indicates the result of the operation

# route /api/rate/:ContentID()

Route:
MethodPath
POST /api/rate/:ContentID
Posts a rating for a piece of content from a certain user
Authentication

The user's login token from their localstorage

Body Parameters:
Name Type Description
username String The username of the person leaving the rating
rating Boolean True if the rating is positive or false if the rating is negative
Header Parameters:
Name Type Description
Content-Type String The type of data contained in the body. Should be application/json
Authorization String The local token that proves the user is signed in
Route Parameters:
Name Type Description
:ContentID String The ID of a piece of content
To Do:
  • Give a proper message instead of returning the DB row
  • Properly check if the body params are fulfilled

View Source server/qrs/queries.js, line 333

The inserted row into the database or a string containing an error message

# Browse() → {JSX.Element}

Allows users to browse for content by applying tags, search terms, categories, etc

View Source client/src/pages/Browse.js, line 19

A Browse component.
JSX.Element

# Comment(props) → {JSX.Element}

Shows a comment left on a piece of content
Parameters:
Name Type Description
props Object
CommentData string // The contents of a comment component

View Source client/src/components/Comment.js, line 12

A Comment component.
JSX.Element

# ContentCard(props) → {JSX.Element}

Displays a content's data, including the thumbnail, rating, title, author, etc
Parameters:
Name Type Description
props Object
ContentID string // The ID of a piece of user content

View Source client/src/components/ContentCard.js, line 15

A ContentCard component.
JSX.Element

# ContentDetails(props) → {JSX.Element}

Shows a detailed information about a piece of content, like its full description
Parameters:
Name Type Description
props Object
ContentID string // The ID of a piece of user content

View Source client/src/components/ContentDetails.js, line 18

A ContentDetails component.
JSX.Element

# ContentPage() → {JSX.Element}

Shows more detailed information about a piece of content and its comments

View Source client/src/pages/ContentPage.js, line 19

A ContentPage component.
JSX.Element

# Home() → {JSX.Element}

The main page of the website. Shows recent announcements and featured content

View Source client/src/pages/Home.js, line 9

A Home component.
JSX.Element

# Login() → {JSX.Element}

Allows users to log into their profiles, which is required to upload content and leave comments

View Source client/src/pages/Login.js, line 12

A Login component.
JSX.Element

# NotFound() → {JSX.Element}

Shown when the user navigates to an invalid URL on the site

View Source client/src/pages/NotFound.js, line 8

A NotFound component.
JSX.Element

# Profile() → {JSX.Element}

Shows information about a user and the content they've uploaded

View Source client/src/pages/Profile.js, line 13

A Profile component.
JSX.Element

# ProfileCard(props) → {JSX.Element}

Shows a user's profile data, including their name, PFP, bio, and average content rating
Parameters:
Name Type Description
props Object
Username string A user's username

View Source client/src/components/ProfileCard.js, line 14

A ProfileCard component.
JSX.Element

# RatingBar(props) → {JSX.Element}

Displays a rating/review bar where the negative side is red and the positive side is green
Parameters:
Name Type Description
props Object
fontSize string The size of the icons on both sides of the progress bar
rating string The value represented by the rating bar. Can range between 0 to 100 (inclusive)

View Source client/src/components/RatingBar.js, line 13

A RatingBar component
JSX.Element

# Upload() → {JSX.Element}

Allows users to log into their profiles, which is required to upload content and leave comments

View Source client/src/pages/Upload.js, line 13

A Login component.
JSX.Element