Skip to content

nourajazbeh/Fastapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

from typing import Union

from fastapi import FastAPI from pydantic import BaseModel

app = FastAPI()

class Item(BaseModel): name:str price:float is_offer: bool = None

@app.get("/") def read_root(): return {"Hello": "World"}

@app.get("/items/{item_id}") def read_item(item_id: int, q: str =None): return {"item_id": item_id, "q": q}

@app.put("/items/{item_id}") def save_item(item_id: int, item: Item): return {"item_name": item.price, "item_id": item_id}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages