Skip to content

Commit 3776e35

Browse files
committed
parte 0
0 parents  commit 3776e35

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
venv
2+
__pycache__

main.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from typing import Union
2+
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

Comments
 (0)