apidemov1 / app.py
Danielrahmai1991's picture
Update app.py
2ae263a verified
raw
history blame contribute delete
485 Bytes
from fastapi import FastAPI
app = FastAPI()
# @app.get("/")
# async def read_root():
# return {"message": "Hello, World mohammad!"}
# from fastapi import FastAPI
from pydantic import BaseModel
# app = FastAPI()
# Define a Pydantic model for the request body
class Item(BaseModel):
name: str
description: str = None
price: float
tax: float = None
@app.post("/items/")
def create_item(item: Item):
return {"item": item, "message": "Hello, World mohammad!"}