16. Asynchronous Endpoints and Streaming Responses
Difference Between Sync and Async Routes
from fastapi import FastAPI
app = FastAPI()
@app.get("/sync")
def sync_route():
return {"type": "sync"}
@app.get("/async")
async def async_route():
return {"type": "async"}When Async Improves Performance and When It Does Not
Streaming Large Responses and Long-Running Operations
Last updated