Files
web-inspector/backend/app/main.py
jungwoo choi 81b9104aea feat: 사이트 전체 검사 기능 추가
도메인 하위 링크를 BFS로 자동 크롤링하여 페이지별 검사 수행.
- BFS 링크 크롤러 (같은 도메인 필터링, max_pages/max_depth 설정)
- 사이트 검사 오케스트레이션 (크롤링→순차 검사→집계)
- SSE 실시간 진행 상태 (크롤링/검사/완료)
- 페이지 트리 + 집계 결과 UI
- UrlInputForm에 "사이트 전체 검사" 버튼 추가

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 16:46:49 +09:00

60 lines
1.6 KiB
Python

"""
Web Inspector API - FastAPI application entry point.
"""
import logging
from contextlib import asynccontextmanager
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from app.core.database import connect_db, close_db
from app.core.redis import connect_redis, close_redis
from app.routers import health, inspections, reports, site_inspections
# Configure logging
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s [%(levelname)s] %(name)s: %(message)s",
)
logger = logging.getLogger(__name__)
@asynccontextmanager
async def lifespan(app: FastAPI):
"""Application lifespan: connect/disconnect databases."""
# Startup
logger.info("Starting Web Inspector API...")
await connect_db()
await connect_redis()
logger.info("Web Inspector API started successfully")
yield
# Shutdown
logger.info("Shutting down Web Inspector API...")
await close_db()
await close_redis()
logger.info("Web Inspector API shut down")
app = FastAPI(
title="Web Inspector API",
version="1.0.0",
description="URL 기반 웹 표준 검사 도구 API",
lifespan=lifespan,
)
# CORS middleware
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
# Register routers
app.include_router(health.router, prefix="/api", tags=["Health"])
app.include_router(inspections.router, prefix="/api", tags=["Inspections"])
app.include_router(reports.router, prefix="/api", tags=["Reports"])
app.include_router(site_inspections.router, prefix="/api", tags=["Site Inspections"])