37 lines
1.0 KiB
Python
37 lines
1.0 KiB
Python
"""FastAPI application entry point."""
|
|
|
|
from contextlib import asynccontextmanager
|
|
|
|
from fastapi import FastAPI
|
|
|
|
from app.config import settings
|
|
from app.routers import auth, users, worlds, assets
|
|
|
|
|
|
@asynccontextmanager
|
|
async def lifespan(app: FastAPI):
|
|
"""Application lifespan: startup and shutdown events."""
|
|
# Startup: initialize database, connect to Redis, etc.
|
|
yield
|
|
# Shutdown: close connections, cleanup
|
|
|
|
|
|
app = FastAPI(
|
|
title=settings.app_name,
|
|
version=settings.app_version,
|
|
description="Agentic Game Platform - Backend API",
|
|
lifespan=lifespan,
|
|
)
|
|
|
|
# Include routers
|
|
app.include_router(auth.router, prefix="/api/auth", tags=["auth"])
|
|
app.include_router(users.router, prefix="/api/users", tags=["users"])
|
|
app.include_router(worlds.router, prefix="/api/worlds", tags=["worlds"])
|
|
app.include_router(assets.router, prefix="/api/assets", tags=["assets"])
|
|
|
|
|
|
@app.get("/api/health")
|
|
async def health_check():
|
|
"""Simple health check endpoint."""
|
|
return {"status": "ok", "app": settings.app_name}
|