YouTip LogoYouTip

FastAPI Tutorial - Getting Started

FastAPI

from fastapi import FastAPI
app = FastAPI()

@app.get("/")
def root():
    return {"Hello": "World"}

@app.post("/items/")
def create_item(name: str, price: float):
    return {"name": name, "price": price}

Run

uvicorn main:app --reload

Summary

  • FastAPI validates with type hints
  • Auto-generated docs at /docs
← PHP Tutorial - Getting StartedDjango Tutorial - Getting Star β†’