V2.0.0-alpha2 2025-05-13
This commit is contained in:
11
app.py
11
app.py
@@ -2,8 +2,12 @@ from fastapi import FastAPI
|
||||
from fastapi.responses import FileResponse
|
||||
from fastapi import Request, HTTPException
|
||||
from contextlib import asynccontextmanager
|
||||
from routes import (session, admin, object)
|
||||
import model.database
|
||||
import os
|
||||
import os, asyncio
|
||||
|
||||
# 初始化数据库
|
||||
asyncio.run(model.database.Database().init_db())
|
||||
|
||||
# 定义程序参数
|
||||
APP_NAME: str = 'Findreve'
|
||||
@@ -31,6 +35,11 @@ app = FastAPI(
|
||||
lifespan=lifespan
|
||||
)
|
||||
|
||||
# 挂载后端路由
|
||||
app.include_router(admin.Router)
|
||||
app.include_router(session.Router)
|
||||
app.include_router(object.Router)
|
||||
|
||||
@app.get("/")
|
||||
def read_root():
|
||||
return FileResponse("dist/index.html")
|
||||
|
||||
Reference in New Issue
Block a user