python FastAPI 最小服务

from fastapi import FastAPI,Request
import uvicorn

app = FastAPI()

@app.get("/health")
def health():
return {"ok": True}

@app.post("/echo")
async def echo(request: Request):
data = await request.json()
return data

if name == "main":
uvicorn.run(app, host="127.0.0.1", port=8000)

posted @ 2026-06-15 10:14  呵哈哈哈哈  阅读(1)  评论(0)    收藏  举报