We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
0 parents commit 2b7ab2fCopy full SHA for 2b7ab2f
.gitignore
@@ -0,0 +1 @@
1
+__pycache__
README.md
@@ -0,0 +1,13 @@
+# FastAPI - demo
2
+
3
+Install FastAPI with all the optional dependencies and features:
4
+```sh
5
+pip install "fastapi[all]"
6
+```
7
8
+Start `uvicorn` with:
9
10
+uvicorn main:app --reload
11
12
13
+Access the API documentation at http://localhost:8000/docs
main.py
@@ -0,0 +1,15 @@
+from typing import Union
+from fastapi import FastAPI
+app = FastAPI()
+@app.get("/")
+def read_root():
+ return {"Hello": "World"}
+@app.get("/items/{item_id}")
14
+def read_item(item_id: int, q: Union[str, None] = None):
15
+ return {"item_id": item_id, "q": q}
0 commit comments