feat: Update endpoint some-endpoint

This commit is contained in:
Backend IM Bot 2025-03-18 15:48:49 +00:00
parent c09f83ec73
commit f163fc82e0

View File

@ -0,0 +1,22 @@
from fastapi import APIRouter, Depends, HTTPException
from pydantic import BaseModel
router = APIRouter()
class HelloMessage(BaseModel):
message: str
@router.post("/api/v1/endpoint")
async def hello_world(body: HelloMessage):
"""Demo hello world endpoint"""
if body.message.lower() != "hello":
raise HTTPException(status_code=400, detail="Message must be 'hello'")
return {
"message": "Success",
"data": "world",
"metadata": {
"received_message": body.message,
"timestamp": "demo_timestamp"
}
}