This commit is contained in:
gaoshuaixing
2024-02-06 14:21:57 +08:00
parent 59e314d3f6
commit 7c39580237
2 changed files with 28 additions and 0 deletions

27
python/main.py Normal file
View File

@@ -0,0 +1,27 @@
import uvicorn
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
async def index():
"""
注册一个根路径
:return:
"""
return {"message": "Hello World"}
@app.get("/info")
async def info():
"""
项目信息
:return:
"""
return {
"app_name": "FastAPI框架学习",
"app_version": "v0.0.1"
}
if __name__ == "__main__":
uvicorn.run(app, host="127.0.0.1", port=8000)