Your task for the COMP229 midterm is to wire up a RESTful API that manages a collection of video games. An Express server is already configured to run on port 3000, and a starter library of game data is provided—you just need to implement each endpoint.
- GET /api/games – Retrieve the full list of games.
- GET /api/games/filter?genre=[genre name] – Retrieve games whose genre matches the query.
- GET /api/games/:id – Retrieve a game by its index (ID).
- POST /api/games – Add a new game to the library.
- PUT /api/games/:id – Update a game by its index (ID).
- DELETE /api/games/:id – Remove a game by its index (ID).
The starter data lives in server.js, but you must complete the logic for every endpoint above.
Below is an example of the object structure you will manipulate (the one below refers to books not games, but you got the idea: there is an array of games already in the code or use your own):
Add exactly two games to the starter array based on the last digit of your student ID:
- 0–1: Add 2 games released between 1990–1999
- 2–3: Add 2 games released between 2000–2009
- 4–5: Add 2 games released between 2010–2019
- 6–7: Add 2 games released between 2020–2024
- 8–9: Add 2 indie games (any year)
Example: Student ID 301234567 ends in 7 ⇒ add two games released between 2020–2024.
{
title: 'Game Title',
genre: 'Genre',
platform: 'Primary Platform',
year: YYYY,
developer: 'Studio Name'
}Capture at least one API response that clearly displays the entire personalized library (starter games + your two additions = 7 total).
- Clone the repository
https://github.com/CENT-COL/COMP229-MIDTERM - Install dependencies
npm install
- Run the server
The server listens on port
npm start
3000. - Test the API
Use Postman, Thunder Client, Insomnia, or a similar tool. For each endpoint:- Make the request using the correct method and URL.
- Include the request body for POST and PUT calls.
- Verify the response payload and HTTP status code.
-
Screenshots
Provide clear evidence of testing for all six endpoints. Every screenshot must show:- Request URL and method
- Request body when applicable
- Successful response with status code
- At least one screenshot highlighting your complete 7-game library
Filename convention:
[StudentID]_[LastName]_[EndpointNumber]_[Method].png
Example:301234567_Smith_01_GET_ALL.pngNeed a reference?
public/images/postman-example.jpgshowcases the expected layout. -
Code Submission
- Zip your project files.
- Share the GitHub repository link containing your implementation.
- Keep screenshots organized and easy to review.
- Confirm your personalized games appear in both code and responses.
-
Reflection (optional, but recommended)
Summarize in a short paragraph how you validated each endpoint and any edge cases considered.
- Personalized additions that match your student ID rule set
- Proper screenshot naming conventions
- Unique game selections across submissions
Suspected irregularities will be investigated according to academic integrity policies.
Write clean, well-structured code, validate inputs, and handle errors gracefully. You’ve got this!
