I moved the routes for the individual collections into separate files using Flask Blueprints. For example, the routes:
get_user()
create_user()
update_user()
delete_user()
_have been moved into a file called userroutes.py.
There are 5 new files: feed_routes.py, helper_functions.py, post_routes.py, user_routes.py, recipe_routes.py.
As mentioned above, I moved all the x_routes functions into their new file locations, and because of this, the server.py file is much shorter. This leads to greater visibility and more reliability.
Flask Blueprints allow you to create blueprints of all functions in a file and then in the main server.py file simply import them and register them into the Flask app object.
The helper_functions.py file holds all the functions used in other routes but aren't routes themselves. For example: connect_to_db() and try_connect_to_db()
Note for reviewers: Since I am splitting the server.py file into multiple locations, I don't think GitHub will tell you if the PR is missing new files. You must verify that the current code in UNLV-CS472-672/2024-S-GROUP5-Munch:Main is located in their respective functions in rparker2003/Munch:server-route-organization before merging the request.
Screenshots (optional)
How to Test
Start up the server.py file and use postman to test the various routes like normal.
Checklist
[x] I have added/updated relevant documentation, and I have followed the coding style guidelines.
[ ] I have made sure the current code is up to date with the main repository.
[ ] I have checked for any potential conflicts with other branches and fixed any merge conflicts.
Description / Changes Made
I moved the routes for the individual collections into separate files using Flask Blueprints. For example, the routes:
There are 5 new files:
feed_routes.py, helper_functions.py, post_routes.py, user_routes.py, recipe_routes.py
.As mentioned above, I moved all the x_routes functions into their new file locations, and because of this, the server.py file is much shorter. This leads to greater visibility and more reliability.
Flask Blueprints allow you to create blueprints of all functions in a file and then in the main server.py file simply import them and register them into the Flask app object.
The helper_functions.py file holds all the functions used in other routes but aren't routes themselves. For example: connect_to_db() and try_connect_to_db()
Note for reviewers: Since I am splitting the server.py file into multiple locations, I don't think GitHub will tell you if the PR is missing new files. You must verify that the current code in
UNLV-CS472-672/2024-S-GROUP5-Munch:Main
is located in their respective functions inrparker2003/Munch:server-route-organization
before merging the request.Screenshots (optional)
How to Test
Checklist