Danielrahmai1991 commited on
Commit
cde7995
·
verified ·
1 Parent(s): 11a6555

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -1
app.py CHANGED
@@ -4,4 +4,21 @@ app = FastAPI()
4
 
5
  @app.get("/")
6
  def read_root():
7
- return {"message": "Hello, World mohammad!"}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
 
5
  @app.get("/")
6
  def read_root():
7
+ return {"message": "Hello, World mohammad!"}
8
+
9
+
10
+ # from fastapi import FastAPI
11
+ from pydantic import BaseModel
12
+
13
+ # app = FastAPI()
14
+
15
+ # Define a Pydantic model for the request body
16
+ class Item(BaseModel):
17
+ name: str
18
+ description: str = None
19
+ price: float
20
+ tax: float = None
21
+
22
+ @app.post("/items/")
23
+ def create_item(item: Item):
24
+ return {"item": item, "message": "Hello, World mohammad!"}