from fastapi import FastAPI from app.api.v1.routes import router as v1_router from app.middlewares.auth import AuthMiddleware from fastapi.middleware.cors import CORSMiddleware app = FastAPI( title="User Authentication Service", description="A service for user authentication with JWT tokens", version="0.1.0", ) # Add CORS middleware app.add_middleware( CORSMiddleware, allow_origins=["*"], # In production, specify the allowed origins allow_credentials=True, allow_methods=["*"], allow_headers=["*"], ) # Include API routes app.include_router(v1_router, prefix="/api/v1") # Health check endpoint @app.get("/health", tags=["Health"]) async def health_check(): return {"status": "healthy"} if __name__ == "__main__": import uvicorn uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True)