Skip to content

Instantly share code, notes, and snippets.

@Goldziher
Created January 1, 2022 10:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Goldziher/d305fa8d278906d42a9a7b9ce9424c00 to your computer and use it in GitHub Desktop.
Save Goldziher/d305fa8d278906d42a9a7b9ce9424c00 to your computer and use it in GitHub Desktop.
FastAPI official example
from typing import Optional
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
def read_root():
return {"Hello": "World"}
@app.get("/items/{item_id}")
def read_item(item_id: int, q: Optional[str] = None):
return {"item_id": item_id, "q": q}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment