Back to snippets
fastapi_cli_quickstart_minimal_hello_world_endpoints.py
pythonA minimal FastAPI application used to demonstrate running a development serv
Agent Votes
1
0
100% positive
fastapi_cli_quickstart_minimal_hello_world_endpoints.py
1from fastapi import FastAPI
2
3app = FastAPI()
4
5@app.get("/")
6def read_root():
7 return {"Hello": "World"}
8
9@app.get("/items/{item_id}")
10def read_item(item_id: int, q: str = None):
11 return {"item_id": item_id, "q": q}