Add first lab code

This commit is contained in:
2026-10-09 14:57:52 +03:00
parent 65003b6119
commit d9fe67a8ce
24 changed files with 1040 additions and 9 deletions
+22
View File
@@ -0,0 +1,22 @@
from fastapi import FastAPI
from fastapi.exceptions import RequestValidationError
from starlette.exceptions import HTTPException
from .errors import APIError, api_error_handler, validation_error_handler, http_error_handler, internal_error_handler
from .middleware import RequestIdMiddleware
from .limits import ResourceLimitMiddleware
from .routers.health import router as health_router
from .routers.users import router as users_router
from .routers.chats import router as chats_router
app = FastAPI(title="MTUSI Messenger")
app.add_middleware(ResourceLimitMiddleware)
app.add_middleware(RequestIdMiddleware)
app.add_exception_handler(APIError, api_error_handler)
app.add_exception_handler(RequestValidationError, validation_error_handler)
app.add_exception_handler(HTTPException, http_error_handler)
app.add_exception_handler(Exception, internal_error_handler)
app.include_router(health_router)
app.include_router(users_router)
app.include_router(chats_router)