routes¶
- class litestar.routes.ASGIRoute[原始碼]¶
基底類別:
BaseRoute[HTTPScope|WebSocketScope]An ASGI route, handling a single
ASGIRouteHandler- __init__(*, path: str, route_handler: ASGIRouteHandler) None[原始碼]¶
Initialize the route.
- 參數:
path¶ -- The path for the route.
route_handler¶ -- An instance of
ASGIRouteHandler.
- class litestar.routes.BaseRoute[原始碼]¶
-
Base Route class used by Litestar.
It's an abstract class meant to be extended.
- class litestar.routes.HTTPRoute[原始碼]¶
-
An HTTP route, capable of handling multiple
HTTPRouteHandlers.- __init__(*, path: str, route_handlers: Iterable[HTTPRouteHandler]) None[原始碼]¶
初始化
HTTPRoute。- 參數:
path¶ -- The path for the route.
route_handlers¶ -- A list of
HTTPRouteHandler.
- create_handler_map(route_handlers: Iterable[HTTPRouteHandler]) dict[HttpMethodName, HTTPRouteHandler][原始碼]¶
Parse the
router_handlersof this route and return a mapping of http- methods and route handlers.
- class litestar.routes.WebSocketRoute[原始碼]¶
基底類別:
BaseRoute[WebSocketScope]A websocket route, handling a single
WebsocketRouteHandler- __init__(*, path: str, route_handler: WebsocketRouteHandler) None[原始碼]¶
Initialize the route.
- 參數:
path¶ -- The path for the route.
route_handler¶ -- An instance of
WebsocketRouteHandler.