2025-09-10 15:07:50 +08:00
|
|
|
from fastapi import APIRouter
|
|
|
|
|
|
|
|
# 创建 APIRouter 实例
|
|
|
|
router = APIRouter(prefix="/bigscreen", tags=["大屏展示"])
|
|
|
|
|
|
|
|
# 定义根路由,返回 helloWorld
|
|
|
|
@router.get("/")
|
|
|
|
async def root():
|
|
|
|
return {"message": "helloWorld"}
|
|
|
|
|
|
|
|
# 定义一个 helloWorld 路由
|
|
|
|
@router.get("/hello")
|
|
|
|
async def hello_world():
|
|
|
|
return {"message": "helloWorld"}
|
|
|
|
|
|
|
|
# 定义一个带有参数的路由
|
|
|
|
@router.get("/hello/{name}")
|
|
|
|
async def hello_name(name: str):
|
|
|
|
return {"message": f"helloWorld, {name}!"}
|