A simple mock To-Do List API using FastAPI and Mongita.
A simple mock To-Do List API using FastAPI and Mongita, with basic CRUD operations allowing you to create, update and delete tasks.
- Clone the repo
git clone https://github.com/TomJGooding/fastapi-simple-todo-mock.git
- Install the requirements. It is recommended to first create a virtual environment.
python3 -m pip install -r requirements.txt
Run the Uvicorn server with:
uvicorn main:app
Swagger UI is a browser-based tool for interacting with REST APIs, and FastAPI creates this user interface for the API automatically.
Open your browser at http://localhost:8000/docs
For example, to create a new task:
- Expand the POST /todos Create Task item.
- Click the Try it out button, which will allow you to fill the parameters.
- Then click the Execute button. The user interface will communicate with your API, send the parameters, get the results and show them on the screen.
HTTPie is a command-line HTTP client for interacting with APIs & HTTP servers.
You will need to have the FastAPI server running in the background.
For example, create a new task with:
http POST localhost:8000/todos id=1 title="Water the plants" complete=False
- The Python REST APIs With FastAPI video course by Real Python for getting started with FastAPI
Licensed under the GNU General Public License v3.0.