diff --git a/Start.py b/Start.py index e69de29..8f15a62 100644 --- a/Start.py +++ b/Start.py @@ -0,0 +1,27 @@ +# pip install fastapi uvicorn + +from fastapi import FastAPI +import uvicorn + +# 创建 FastAPI 应用实例 +app = FastAPI(title="云南教育决策研究服务系统", description="云南省教育数据分析和可视化平台") + +# 定义根路由,返回 helloWorld +@app.get("/") +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__": + # 启动 FastAPI 应用,监听 8100 端口 + uvicorn.run(app, host="0.0.0.0", port=8100) \ No newline at end of file