"""FastAPI application factory.""" from fastapi import FastAPI from hubgw.core.logging import setup_logging from hubgw.context import AppContext def create_app() -> FastAPI: """Create and configure FastAPI application.""" app = FastAPI( title="HubGW", description="FastAPI Gateway for HubMC", version="0.1.0" ) # Setup logging setup_logging() # Initialize context ctx = AppContext() @app.on_event("startup") async def startup(): await ctx.startup() @app.on_event("shutdown") async def shutdown(): await ctx.shutdown() # Include routers from hubgw.api.v1.router import api_router app.include_router(api_router, prefix="/api/v1") return app