路由¶
- class litestar.routes.ASGIRoute¶
基类:
BaseRouteAn 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¶
基类:
ABCBase Route class used by Litestar.
It's an abstract class meant to be extended.
- class litestar.routes.HTTPRoute¶
基类:
BaseRouteAn HTTP route, capable of handling multiple
HTTPRouteHandlers.- __init__(*, path: str, route_handlers: list[HTTPRouteHandler]) None¶
Initialize
HTTPRoute.- 参数:
path¶ -- The path for the route.
route_handlers¶ -- A list of
HTTPRouteHandler.
- async handle(scope: HTTPScope, receive: Receive, send: Send) None¶
ASGI app that creates a Request from the passed in args, determines which handler function to call and then handles the call.
- create_handler_map() None¶
Parse the
router_handlersof this route and return a mapping of http- methods and route handlers.
- create_options_handler(path: str) HTTPRouteHandler¶
- 参数:
path¶ -- The route path
- 返回:
An HTTP route handler for OPTIONS requests.
- class litestar.routes.WebSocketRoute¶
基类:
BaseRouteA 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.