Do not clone this repository because we will use a different template.
We recommend opening the project using Codespaces (recommended) or Gitpod. Alternatively, you can clone the repository to your local computer using git clone.
This is the base repository you need to use:
https://github.com/4GeeksAcademy/python-hello
⚠ You will need Python installed if working locally, but everything is preconfigured in Codespaces or Gitpod.
1pip install fastapi uvicorn
Example:
1from pydantic import BaseModel 2 3class Item(BaseModel): 4 id: int 5 name: str 6 quantity: int 7 price: float
Basic example:
1from fastapi import FastAPI 2 3app = FastAPI() 4 5inventory = [] 6 7@app.get("/items") 8def get_items(): 9 return inventory 10 11@app.post("/items") 12def add_item(item: Item): 13 inventory.append(item) 14 return item
Explore different enhancements to make your API more functional and useful!
In order to prepare better for completing this exercises, we suggest the following materials