class_docstr: HTTPApp creates a REST API server based on APIs defined with a BentoService
  via BentoService#apis. Each InferenceAPI will become one
  endpoint exposed on the REST server, and the RequestHandler defined on each
  InferenceAPI object will be used to handle Request object before feeding the
  request data into a Service API function
class_docstr_tok: ["HTTPApp","creates","a","REST","API","server","based","on","APIs","defined","with","a","BentoService","via","BentoService","#","apis",".","Each","InferenceAPI","will","become","one","endpoint","exposed","on","the","REST","server",",","and","the","RequestHandler","defined","on","each","InferenceAPI","object","will","be","used","to","handle","Request","object","before","feeding","the","request","data","into","a","Service","API","function"]
docstr: Setup routes for bento model server, including:
  
  /               Index Page, shows readme docs, metadata, and Swagger UI
  /docs.json      Returns Swagger/OpenAPI definition file in json format
  /healthz        liveness probe endpoint
  /readyz         Readiness probe endpoint
  /metrics        Prometheus metrics endpoint
  
  And user defined InferenceAPI list into routes, e.g.:
  /classify
  /predict
docstr_tok: ["Setup","routes","for","bento","model","server",",","including",":","\/","Index","Page",",","shows","readme","docs",",","metadata",",","and","Swagger","UI","\/docs.json","Returns","Swagger\/OpenAPI","definition","file","in","json","format","\/healthz","liveness","probe","endpoint","\/readyz","Readiness","probe","endpoint","\/metrics","Prometheus","metrics","endpoint","And","user","defined","InferenceAPI","list","into","routes",",","e.g",".",":","\/classify","\/predict"]
code: def routes(self) -> list[BaseRoute]:
      """
      Setup routes for bento model server, including:
  
      /               Index Page, shows readme docs, metadata, and Swagger UI
      /docs.json      Returns Swagger/OpenAPI definition file in json format
      /healthz        liveness probe endpoint
      /readyz         Readiness probe endpoint
      /metrics        Prometheus metrics endpoint
  
      And user defined InferenceAPI list into routes, e.g.:
      /classify
      /predict
      """
      from starlette.routing import Mount
      from starlette.routing import Route
      from starlette.staticfiles import StaticFiles
  
      routes = super().routes
  
      routes.append(
          Route(path="/", name="home", endpoint=self.index_view_func)
      )
      routes.append(
          Route(
              path="/docs.json",
              name="docs",
              endpoint=self.docs_view_func,
          )
      )
  
      parent_dir_path = os.path.dirname(os.path.realpath(__file__))
      routes.append(
          Mount(
              "/static_content",
              app=StaticFiles(
                  directory=os.path.join(
                      parent_dir_path, "static_content"
                  )
              ),
              name="static_content",
          )
      )
  
      for _, api in self.bento_service.apis.items():
          api_route_endpoint = self._create_api_endpoint(api)
          if api.route.startswith("/"):
              route_path = api.route
          else:
              route_path = f"/{api.route}"
  
          routes.append(
              Route(
                  path=route_path,
                  name=api.name,
                  endpoint=api_route_endpoint,
                  methods=api.input.HTTP_METHODS,
              )
          )
  
      return routes
  
imports: from __future__ import annotations
  import asyncio
  import functools
  import logging
  import os
  import sys
  import typing
  from simple_di import Provide
  from simple_di import inject
  from starlette.exceptions import HTTPException
  from starlette.responses import PlainTextResponse
  from ...exceptions import BentoMLException
  from ..configuration.containers import BentoMLContainer
  from ..context import trace_context
  from ..server.base_app import BaseAppFactory
  from ..service.service import Service
label_desc: Use image node_id 3 for calling the HTTPAppFactory obj's underlying member method code with example usage: obj.routes() and returns: routes