apidemov1 / main.py
Danielrahmai1991's picture
Update main.py
203ca02 verified
raw
history blame contribute delete
479 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!"}