Methods
# route /api/browseContent()
Route:
Method | Path |
---|---|
GET | /api/browseContent?page |
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 |
An array of content IDs or a string containing an error message
# route /api/commentCount/:ContentID()
Route:
Method | Path |
---|---|
GET | /api/commentCount/:ContentID |
Route Parameters:
Name | Type | Description |
---|---|---|
:ContentID | String | The ID of a piece of content |
An object containing the number of items at key count or a string containing an error message
# route /api/comments/:ContentID()
Route:
Method | Path |
---|---|
GET | /api/comments/:ContentID?page |
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 |
An array of comment data or a string containing an error message
# route /api/contentCard/:ContentID()
Route:
Method | Path |
---|---|
GET | /api/contentCard/:ContentID |
Route Parameters:
Name | Type | Description |
---|---|---|
:ContentID | String | The unique ID of a piece of uploaded content |
An object containing the content details or a string with an error message
# route /api/contentDetails/:ContentID()
Route:
Method | Path |
---|---|
GET | /api/contentDetails/:ContentID |
Route Parameters:
Name | Type | Description |
---|---|---|
:ContentID | String | The unique ID of a piece of uploaded content |
An object containing the content details or a string with an error message
# route /api/contentUpload()
Route:
Method | Path |
---|---|
POST | /api/contentUpload |
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
A string containing the ID of the uploaded content or an error if something went wrong
# route /api/countContent()
Route:
Method | Path |
---|---|
GET | /api/countContent?&tags |
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 |
An object containing the number of items at key count or a string containing an error message
# route /api/countProfileContent()
Route:
Method | Path |
---|---|
GET | /api/countProfileContent/:Username |
Route Parameters:
Name | Type | Description |
---|---|---|
:Username | String | The user's username |
An object containing the number of items at key count or a string containing an error message
# route /api/fullprofile/:Username()
Route:
Method | Path |
---|---|
GET | /api/fullprofile/:Username |
Route Parameters:
Name | Type | Description |
---|---|---|
:Username | String | The user's username |
An object containing the profile data or a string containing an error message
# route /api/getEmail/:Username()
Route:
Method | Path |
---|---|
GET | /api/getEmail/:Username |
Route Parameters:
Name | Type | Description |
---|---|---|
:Username | String | The user's username |
An object containing the email at key email or a string containing an error message
# route /api/login()
Route:
Method | Path |
---|---|
POST | /api/login |
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!
An object containing the token at key token or a string containing an error message
# route /api/newComment/:ContentID()
Route:
Method | Path |
---|---|
POST | /api/newComment/:ContentID |
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
The inserted row into the database or a string containing an error message
# route /api/protected()
Route:
Method | Path |
---|---|
/api/protected |
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 |
A string containing a message that indicates the result of the operation
# route /api/rate/:ContentID()
Route:
Method | Path |
---|---|
POST | /api/rate/:ContentID |
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
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
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 |
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 |
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 |
A ContentDetails component.
JSX.Element
# ContentPage() → {JSX.Element}
Shows more detailed information about a piece of content and its comments
A ContentPage component.
JSX.Element
# Home() → {JSX.Element}
The main page of the website. Shows recent announcements and featured content
A Home component.
JSX.Element
# Login() → {JSX.Element}
Allows users to log into their profiles, which is required to upload content and leave comments
A Login component.
JSX.Element
# NotFound() → {JSX.Element}
Shown when the user navigates to an invalid URL on the site
A NotFound component.
JSX.Element
# Profile() → {JSX.Element}
Shows information about a user and the content they've uploaded
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 |
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) |
A RatingBar component
JSX.Element
# Upload() → {JSX.Element}
Allows users to log into their profiles, which is required to upload content and leave comments
A Login component.
JSX.Element