[FWA-5] Home Create and List

This commit is contained in:
2024-07-03 08:57:50 +00:00
parent 1c205c69ac
commit b938f296c1
33 changed files with 414 additions and 93 deletions

View File

@ -1,6 +1,7 @@
from collections.abc import AsyncGenerator
from contextlib import asynccontextmanager
from fastapi import FastAPI, Request, HTTPException
from fastapi.exceptions import RequestValidationError
from fastapi.responses import JSONResponse
from fastapi.middleware.cors import CORSMiddleware
from fastapi.middleware.gzip import GZipMiddleware
@ -70,6 +71,11 @@ async def unicorn_exception_handler(request: Request, exc: HTTPException):
content={"status": exc.status_code, "data": exc.detail},
)
@app.exception_handler(RequestValidationError)
async def validation_exception_handler(request: Request, exc: RequestValidationError):
print(exc)
return JSONResponse(status_code=422, content={"status": 422, "data": str(exc)})
def api_routers():
app.include_router(router)