code: def register_routes(app: FastAPI):
      app.include_router(users.router)
      app.include_router(projects.router)
      app.include_router(backends.root_router)
      app.include_router(backends.project_router)
      app.include_router(repos.router)
      app.include_router(runs.root_router)
      app.include_router(runs.project_router)
      app.include_router(logs.router)
      app.include_router(secrets.router)
      app.include_router(gateways.router)
  
      @app.exception_handler(ForbiddenError)
      async def forbidden_error_handler(
          request: Request, exc: ForbiddenError
      ):
          return JSONResponse(
              status_code=status.HTTP_403_FORBIDDEN,
              content=error_detail("Access denied"),
          )
  
      @app.exception_handler(ServerClientError)
      async def server_client_error_handler(
          request: Request, exc: ServerClientError
      ):
          return JSONResponse(
              status_code=status.HTTP_400_BAD_REQUEST,
              content={"detail": get_server_client_error_details(exc)},
          )
  
      @app.middleware("http")
      async def log_request(request: Request, call_next):
          start_time = time.time()
          response = await call_next(request)
          process_time = time.time() - start_time
          logger.debug(
              "Processed request %s %s in %s",
              request.method,
              request.url,
              f"{process_time:0.6f}s",
          )
          return response
  
      @app.middleware("http")
      async def check_client_version(request: Request, call_next):
          if (
              not request.url.path.startswith("/api/")
              or request.url.path in _NO_API_VERSION_CHECK_ROUTES
          ):
              return await call_next(request)
          response = check_client_server_compatibility(
              client_version=request.headers.get("x-api-version"),
              server_version=DSTACK_VERSION,
          )
          if response is not None:
              return response
          return await call_next(request)
  
      @app.get("/healthcheck")
      async def healthcheck():
          return JSONResponse(content={"status": "running"})
  
      @app.get("/")
      async def index():
          return RedirectResponse("/api/docs")
  
imports: import os
  import time
  from contextlib import asynccontextmanager
  from typing import Awaitable, Callable, List
  import sentry_sdk
  from fastapi import FastAPI, Request, status
  from fastapi.responses import JSONResponse, RedirectResponse
  from dstack._internal.cli.utils.common import console
  from dstack._internal.core.errors import ForbiddenError, ServerClientError
  from dstack._internal.core.services.configs import update_default_project
  from dstack._internal.server import settings
  from dstack._internal.server.background import start_background_tasks
  from dstack._internal.server.db import get_session_ctx, migrate
  from dstack._internal.server.routers import backends, gateways, logs, projects, repos, runs, secrets, users
  from dstack._internal.server.services.config import ServerConfigManager
  from dstack._internal.server.services.gateways import update_gateways
  from dstack._internal.server.services.projects import get_or_create_default_project
  from dstack._internal.server.services.storage import init_default_storage
  from dstack._internal.server.services.users import get_or_create_admin_user
  from dstack._internal.server.settings import DEFAULT_PROJECT_NAME, DSTACK_DO_NOT_UPDATE_DEFAULT_PROJECT, DSTACK_UPDATE_DEFAULT_PROJECT, SERVER_CONFIG_FILE_PATH, SERVER_URL
  from dstack._internal.server.utils.logging import configure_logging
  from dstack._internal.server.utils.routers import check_client_server_compatibility, error_detail, get_server_client_error_details
  from dstack._internal.settings import DSTACK_VERSION
  from dstack._internal.utils.logging import get_logger
label_desc: Use image node_id 4 for calling a global function with example usage: register_routes(app) and returns: JSONResponse, JSONResponse, response, unknown, JSONResponse, RedirectResponse, unknown, response