agoravaisedeusquiser

This commit is contained in:
2026-05-28 14:56:25 -05:00
parent de6fa39956
commit c924753210
3 changed files with 31 additions and 32 deletions

View File

@@ -1,6 +1,7 @@
from fastapi import FastAPI, Depends
from fastapi import FastAPI, Depends, Request
from fastapi.middleware.cors import CORSMiddleware
from app.core.security import get_current_user, UserAuth
from fastapi.responses import JSONResponse
from app.core.security import get_current_user, UserAuth, AuthException
from app.core.config import settings
from app.api.v1.api import api_router
from app.db.database import Base, engine
@@ -23,6 +24,13 @@ app.add_middleware(
app.include_router(api_router, prefix=settings.API_V1_STR)
@app.exception_handler(AuthException)
async def auth_exception_handler(request: Request, exc: AuthException):
return JSONResponse(
status_code=401,
content={"message": exc.message}
)
@app.get("/")
def root(current_user: UserAuth = Depends(get_current_user)):
return {"message": "Bem-vindo ao Microsserviço de Catálogo do GameVerse"}