Spaces:
Runtime error
Runtime error
Delete backend.py
Browse files- backend.py +0 -25
backend.py
DELETED
|
@@ -1,25 +0,0 @@
|
|
| 1 |
-
from fastapi import FastAPI
|
| 2 |
-
from pydantic import BaseModel
|
| 3 |
-
|
| 4 |
-
app = FastAPI()
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
@app.get("/")
|
| 8 |
-
async def root():
|
| 9 |
-
return {"message": "Hello World"}
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
@app.get("/hello/{name}")
|
| 13 |
-
async def say_hello(name: str):
|
| 14 |
-
return {"message": f"Hello, {name.upper()}"}
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
class Item(BaseModel):
|
| 18 |
-
name: str
|
| 19 |
-
description: str | None = None
|
| 20 |
-
price: float
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
@app.post("/items/")
|
| 24 |
-
async def create_item(item: Item):
|
| 25 |
-
return item
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|