'commit'
This commit is contained in:
@@ -0,0 +1,19 @@
|
|||||||
|
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}!"}
|
BIN
Routes/__pycache__/BigScreen.cpython-310.pyc
Normal file
BIN
Routes/__pycache__/BigScreen.cpython-310.pyc
Normal file
Binary file not shown.
BIN
Routes/__pycache__/__init__.cpython-310.pyc
Normal file
BIN
Routes/__pycache__/__init__.cpython-310.pyc
Normal file
Binary file not shown.
17
Start.py
17
Start.py
@@ -2,24 +2,13 @@
|
|||||||
|
|
||||||
from fastapi import FastAPI
|
from fastapi import FastAPI
|
||||||
import uvicorn
|
import uvicorn
|
||||||
|
from Routes.BigScreen import router as bigscreen_router
|
||||||
|
|
||||||
# 创建 FastAPI 应用实例
|
# 创建 FastAPI 应用实例
|
||||||
app = FastAPI(title="云南教育决策研究服务系统", description="云南省教育数据分析和可视化平台")
|
app = FastAPI(title="云南教育决策研究服务系统", description="云南省教育数据分析和可视化平台")
|
||||||
|
|
||||||
# 定义根路由,返回 helloWorld
|
# 包含大屏展示路由
|
||||||
@app.get("/")
|
app.include_router(bigscreen_router)
|
||||||
async def root():
|
|
||||||
return {"message": "helloWorld"}
|
|
||||||
|
|
||||||
# 定义一个 helloWorld 路由
|
|
||||||
@app.get("/hello")
|
|
||||||
async def hello_world():
|
|
||||||
return {"message": "helloWorld"}
|
|
||||||
|
|
||||||
# 定义一个带有参数的路由
|
|
||||||
@app.get("/hello/{name}")
|
|
||||||
async def hello_name(name: str):
|
|
||||||
return {"message": f"helloWorld, {name}!"}
|
|
||||||
|
|
||||||
# 主程序入口
|
# 主程序入口
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
Reference in New Issue
Block a user