29 lines
672 B
Python
29 lines
672 B
Python
"""测试相关接口"""
|
|
from fastapi import APIRouter
|
|
|
|
from app.schemas.base import ResultDomain
|
|
|
|
router = APIRouter()
|
|
|
|
|
|
@router.get(
|
|
"/world",
|
|
response_model=ResultDomain[str],
|
|
summary="Hello World",
|
|
description="测试接口连通性"
|
|
)
|
|
async def hello_word() -> ResultDomain[str]:
|
|
"""Hello World 测试接口"""
|
|
return ResultDomain.ok(message="Hello World", data="Hello World")
|
|
|
|
|
|
@router.get(
|
|
"/ping",
|
|
response_model=ResultDomain[str],
|
|
summary="Ping测试",
|
|
description="测试服务是否正常运行"
|
|
)
|
|
async def ping() -> ResultDomain[str]:
|
|
"""Ping 测试接口"""
|
|
return ResultDomain.ok(message="pong", data="pong")
|