tmp4 / app.py
LapStore
Add application file
67c10a3
raw
history blame
328 Bytes
from fastapi import FastAPI ,Request
app = FastAPI()
@app.get("/")
def greet_json():
return {"Hello": "World!"}
@app.post("/")
def greet_json(request: Request):
data = request.json() # Get the JSON body of the request
name = data.get("name", "World") # Extract "name" from the request
return {"Hello": name}