- Ryan DeStefano
- Python Libraries Used (★ - Required to run server, ☆ - Required to test the server):
- HTML / CSS / JavaScript
- No libraries or packages need to be installed. Only pure HTML, CSS, and JavaScript were used.
- Makefile / Testing
- Installing GNU Make
- To run test scripts, ensure the server is running, then run one of these
makecommands from the directory containingMakefile:make- Runs all test scripts simultaneouslymake test- Runs all test scripts simultaneouslymake test-separate- Runs each test script individually one after anothermake test-library- Runs tests for the OOAPImake test-tv- Runs tests for the TV shows controllermake test-users- Runs both test scripts for the users controllermake test-users-key- Runs tests for the users controllerKEYevent handlersmake test-users-index- Runs tests for the users controllerINDEXevent handlersmake test-reset- Runs tests for the reset controllermake clean- Empties and removes all__pycache__folders from the project
final_project
\_ jsfrontend
\_ pages
\_ new-user.html
\_ search.html
\_ show.html
\_ user.html
\_ scripts
\_ main.js
\_ new-user.js
\_ search.js
\_ show.js
\_ user.js
\_ css
\_ main.css
\_ index.html
\_ ooapi
\_ test
\_ test_tv_library.py
\_ tv_library.py
\_ tv-shows.json
\_ user.json
\_ server
\_ test
\_ test_reset_endpoint.py
\_ test_tv_shows.py
\_ test_users_index.py
\_ test_users_key.py
\_ ResetController.py
\_ TVController.py
\_ UsersController.py
\_ server.py
\_ Makefile
\_ index.html
- Ensure all packages described above are installed
- Ensure the project has the folder structure described above
- Navigate to the
serverfolder - Execute
python3 server.pyat the command line or runserver.pyfrom your preferred IDE
- TV Shows Controller
GET_KEY- Returns a JSON string of a specific TV showGET_INDEX- Returns a JSON string of all TV shows in the database
- Users Controller
GET_KEY- Returns a JSON string of a specific userPUT_KEY- Reads a request body to modify the details of a specific userDELETE_KEY- Deletes a specific user from the databaseGET_INDEX- Returns a JSON string of all users in the databasePOST_INDEX- Reads a request body to add a new user to the databaseDELETE_INDEX- Deletes all users from the database
- Reset Controller
PUT_KEY_TV- Resets a specific TV show in the databasePUT_KEY_USER- Resets a specific user in the databasePUT_INDEX- Resets all TV shows and users in the database
| Request Type | Resource Endpoint | Body | Expected Response | Inner Working of Handler |
|---|---|---|---|---|
GET |
/tv-shows/ | No body | String formatted JSON with all TV shows | GET_INDEXGoes through all TV shows and gets all their information to put in a list |
GET |
/tv-shows/south-park | No body | String formatted JSON with just South Park | GET_KEYSearches for a specific show's data and returns it as a dictionary |
GET |
/users/ | No body | String formatted JSON with all users | GET_INDEXReturns a dictionary of all users in the database |
GET |
/users/ryan-destefano | No body | String formatted JSON with just ryan-destefano | GET_KEYSearches for a specific user's data and returns it as a dictionary |
PUT |
/users/ryan-destefano | JSON body with specific attributes to be changed. Example:{"email": "[email protected]","name": "Ryan F DeStefano"} |
{"result": "success","attributes": {"email": "Changed","name": "Changed"}}if the request worked |
PUT_KEYReads in each attribute, and if it belongs in the list of possible attributes, updates a specific user |
POST |
/users/ | JSON body with all new user attributes | {"result": "success","id": "ryan-destefano"}if the request worked |
POST_INDEXReads in the body of the request, and if it contains all necessary attributes, adds a new user to the database |
DELETE |
/users/ | Empty JSON body | {"result": "success"}if the request worked |
DELETE_INDEXClears entire dictionary of users from the database |
DELETE |
/users/ryan-destefano | Empty JSON body | {"result": "success"}if the request worked |
DELETE_KEYDeletes a specific key-value pair from the users dictionary in the database based on user ID |
PUT |
/reset/ | Empty JSON body | {"result": "success"}if the request worked |
RESET_INDEXReloads all TV shows and users from tv-shows.json and users.json, respectively |
PUT |
/reset/tv-shows/south-park | Empty JSON body | {"result": "success"}if the request worked |
RESET_KEY_TVReloads a specific TV show from tv-shows.json |
PUT |
/reset/users/ryan-destefano | Empty JSON body | {"result": "success"}if the request worked |
RESET_KEY_USERReloads a specific user from users.json |
- Home Page
- Large jumbotron spans the width of the screen at the top of the page
- All preview images of TV shows in the database are loaded and displayed on a CSS grid
- Information is loaded through a
GETrequest to the/tv-shows/endpoint
- Information is loaded through a
- Users can hover over and click on each show to go to a page to learn more about it
- Shows Page
- More detailed information about a show will be displayed to the user
- The show is determined by the query string in the URL
- Information is loaded through a
GETrequest to the/tv-shows/tvidendpoint
- A link to the show's official website (if it exists) will be present
- The user can choose to hide or show a complete list of episodes with descriptions
- More detailed information about a show will be displayed to the user
- Search Page
- Users can search for specific TV shows based on name, rating, genre, or any combination of the three
- The user can select which criteria to search for by checking and unchecking each box
- All matching shows will be displayed below the search bar(s)
- Information is loaded through a
GETrequest to the/tv-shows/endpoint - The client will then filter the shows based on the search criteria
- Information is loaded through a
- Users can hover over and click on each matching show to go to a page to learn more about it
- Users can search for specific TV shows based on name, rating, genre, or any combination of the three
- Users Page
- Users can type in their usernames to carry out a number of tasks:
- Display information specific to the user
- Update current information with new preferences
- Delete the user from the database completely
- Reset the user to their initial preferences
- These tasks are carried out through a
GET,PUT, orDELETErequest to either the/users/uidor/reset/users/uidendpoints
- Users can type in their usernames to carry out a number of tasks:
- New User Page
- Users can enter all necessary information to create an entirely new profile
- Once the user enters their information, they can register a new account within the database
- This is accomplished through a
POSTrequest to the/users/endpoint
- This is accomplished through a
- Navigation Bar
- A navigation bar is present at the top of every page with links to the other pages in the client
- In order to test each aspect of the front end, the following tasks were carried out:
- Each link was tested to make sure they functioned properly
- All pages that interact with the server were tested in their entirety
- All
GET,PUT,POST, andDELETErequests made by the front end for both TV shows and users were verified to work
- All
- All buttons and forms were tested and verified to work properly
- Server must be running for any tests to work