Skip to main content
You have permission to edit this article.
Edit

Breaking

def verify_password(plain, hashed): return pwd_context.verify(plain, hashed)

You'll also need to install an ASGI server like uvicorn:

# GET endpoint to retrieve a single item by ID @app.get("/items/item_id") def read_item(item_id: int): for item in items: if item["id"] == item_id: return item return "error": "Item not found"

def get_db(): db = SessionLocal() try: yield db finally: db.close()

In this example, we define a route that raises an HTTPException if the user_id is invalid.

FastAPI is built on top of Starlette for the web parts and Pydantic for the data parts. It is designed to be easy to use for developers while providing production-grade performance. Key features include:

Get up-to-the-minute news sent straight to your device.

Topics

all