Created
January 1, 2022 10:02
-
-
Save Goldziher/d305fa8d278906d42a9a7b9ce9424c00 to your computer and use it in GitHub Desktop.
FastAPI official example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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