From f163fc82e0ac6d86d02b125b018f447f2701c266 Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Tue, 18 Mar 2025 15:48:49 +0000 Subject: [PATCH] feat: Update endpoint some-endpoint --- endpoints/some-endpoint.post.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/endpoints/some-endpoint.post.py b/endpoints/some-endpoint.post.py index e69de29..fe1eaa1 100644 --- a/endpoints/some-endpoint.post.py +++ b/endpoints/some-endpoint.post.py @@ -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" + } + } \ No newline at end of file