mirror of
https://gitee.com/dromara/electron-egg.git
synced 2026-05-16 04:32:10 +08:00
27 lines
442 B
Python
27 lines
442 B
Python
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) |