- Add batch inspection backend (multipart upload, SSE streaming, MongoDB) - Add tabbed UI (single page / site crawling / batch upload) on home and history pages - Add batch inspection progress, result pages with 2-panel layout - Rename "사이트 전체" to "사이트 크롤링" across codebase - Add python-multipart dependency for file upload - Consolidate nginx SSE location for all inspection types Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
61 lines
1.7 KiB
Python
61 lines
1.7 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, batch_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"])
|
|
app.include_router(batch_inspections.router, prefix="/api", tags=["Batch Inspections"])
|