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 3776e35Copy full SHA for 3776e35
.gitignore
@@ -0,0 +1,2 @@
1
+venv
2
+__pycache__
main.py
@@ -0,0 +1,17 @@
+from typing import Union
+from fastapi import FastAPI
3
+app = FastAPI()
4
+
5
+@app.get("/")
6
+def read_root():
7
+ return {"message": "Olá, mundo com FastAPI!"}
8
9
+@app.get("/items/{item_id}")
10
+def read_item(item_id: int, q: Union[str, None] = None):
11
+ return {"item_id": item_id, "q": q}
12
13
14
15
+if __name__ == "__main__":
16
+ import uvicorn
17
+ uvicorn.run(app, host="127.0.0.1", port=8000)
0 commit comments