mirror of
https://gitee.com/dromara/electron-egg.git
synced 2026-05-15 04:02:10 +08:00
py
This commit is contained in:
27
python/main.py
Normal file
27
python/main.py
Normal 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)
|
||||
Reference in New Issue
Block a user