- 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
make
commands 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 controllerKEY
event handlersmake test-users-index
- Runs tests for the users controllerINDEX
event 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
server
folder - Execute
python3 server.py
at the command line or runserver.py
from 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_INDEX Goes 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_KEY Searches for a specific show's data and returns it as a dictionary |
GET |
/users/ | No body | String formatted JSON with all users | GET_INDEX Returns a dictionary of all users in the database |
GET |
/users/ryan-destefano | No body | String formatted JSON with just ryan-destefano | GET_KEY Searches 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": "rdestefa@gmail.com", "name": "Ryan F DeStefano"} |
{"result": "success", "attributes": { "email": "Changed", "name": "Changed"}} if the request worked |
PUT_KEY Reads 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_INDEX Reads 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_INDEX Clears entire dictionary of users from the database |
DELETE |
/users/ryan-destefano | Empty JSON body | {"result": "success"} if the request worked |
DELETE_KEY Deletes 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_INDEX Reloads 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_TV Reloads a specific TV show from tv-shows.json |
PUT |
/reset/users/ryan-destefano | Empty JSON body | {"result": "success"} if the request worked |
RESET_KEY_USER Reloads 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
GET
request 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
GET
request to the/tv-shows/tvid
endpoint
- 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
GET
request 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
, orDELETE
request to either the/users/uid
or/reset/users/uid
endpoints
- 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
POST
request 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
, andDELETE
requests 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