21 lines
633 B
Python
21 lines
633 B
Python
from fastapi import APIRouter, Depends, HTTPException
|
|
from core.database import fake_users_db
|
|
|
|
router = APIRouter()
|
|
|
|
@router.post("/yolo-post")
|
|
async def yolo_post_handler(payload: dict = Body(...)):
|
|
"""Reverse input sentence"""
|
|
if "sentence" not in payload:
|
|
raise HTTPException(status_code=400, detail="Missing 'sentence' field in input")
|
|
|
|
input_sentence = payload["sentence"]
|
|
reversed_sentence = input_sentence[::-1]
|
|
|
|
return {
|
|
"message": "Sentence reversed successfully",
|
|
"data": {
|
|
"original": input_sentence,
|
|
"reversed": reversed_sentence
|
|
}
|
|
} |