"""hyungi_Document_Server — FastAPI 엔트리포인트""" from contextlib import asynccontextmanager from fastapi import FastAPI from core.config import settings from core.database import init_db @asynccontextmanager async def lifespan(app: FastAPI): """앱 시작/종료 시 실행되는 lifespan 핸들러""" # 시작: DB 연결, 스케줄러 등록 await init_db() # TODO: APScheduler 시작 (Phase 3) yield # 종료: 리소스 정리 # TODO: 스케줄러 종료, DB 연결 해제 app = FastAPI( title="hyungi_Document_Server", description="Self-hosted PKM 웹 애플리케이션 API", version="2.0.0", lifespan=lifespan, ) @app.get("/health") async def health_check(): return {"status": "ok", "version": "2.0.0"} # TODO: 라우터 등록 (Phase 0~2) # from api import documents, search, tasks, dashboard, export # app.include_router(documents.router, prefix="/api/documents", tags=["documents"]) # app.include_router(search.router, prefix="/api/search", tags=["search"]) # app.include_router(tasks.router, prefix="/api/tasks", tags=["tasks"]) # app.include_router(dashboard.router, prefix="/api/dashboard", tags=["dashboard"]) # app.include_router(export.router, prefix="/api/export", tags=["export"])