Recreate the Flask tutorial in FastAPI.
The app is named Fastr. It is a simple web app that allows user to register, log in, and create posts on a simple page. It creates and accesses a local SQLite database.
The Fastr app has all the functionality of the Flaskr app created in the Flask tutorial and a full suite of unit tests. The only piece of the Flask tutorial that is not currently implemented is the packaging piece (from the "Make the Project Installable" section of the Flask tutorial).
For additional commentary on this FastAPI implementation vs. the original Flask app, see the post on Towards Data Science here (or use this link if you hit a paywall with the first one).
First clone this repository. Then install the requirements (preferably in a virtual environment):
pip install -r requirements.txt
From the root directory, use the following command to run the app with uvicorn:
uvicorn fastr.main:app --reload
(omit the --reload
argument if you don't want the app to refresh when changes are made to the code)
If you have suggestions for better ways to implement any of the functionality using FastAPI, feel free to open an issue and/or submit a pull request. Code should be simple and beginner-friendly. Please ensure that all tests pass and new tests are written for any new functionality before submitting a PR.