Skip to content

Commit 0ceb234

Browse files
committed
Added Query Parameter function
1 parent 50c99c8 commit 0ceb234

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

main.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
app = FastAPI()
44

5+
fake_item_db = [{"item-name ": "Foo"}, {"item-name ": "Bar"}, {"item-name ": "Daz"}]
6+
57

68
#! Root Path
79
@app.get("/")
@@ -20,4 +22,8 @@ async def readItem(item_id: int):
2022
async def readItemName(item_name: str):
2123
return {"Item Name ": item_name}
2224

23-
#! Query Parameters
25+
26+
#! Query Parameters - String eg:- /item?name="{str}"
27+
@app.get("/item")
28+
async def readItemEndpoint(name: str):
29+
return {"Name": name}

0 commit comments

Comments
 (0)