lightspeed/framework/endpoint
Endpoint + middleware pipeline with controller and live-route dispatch.
Types
Endpoint
opaqueEndpoint definition.
pub opaque type Endpoint
One in-memory static asset served by this endpoint.
pub type StaticAsset {
StaticAsset(path: String, content_type: String, body: String)
}
Constructors
-
StaticAsset(path: String, content_type: String, body: String)
Values
pub fn call(
endpoint: Endpoint,
request: http.Request,
) -> http.Response
Handle one request through middleware and dispatch tables.
pub fn get_controller(
endpoint: Endpoint,
route: verified_routes.VerifiedRoute(params),
run: fn(http.Conn) -> http.Conn,
) -> Endpoint
Register a GET controller route from a verified route helper.
pub fn get_controller_indexed(
endpoint: Endpoint,
route: verified_routes.IndexedRoute(
params,
verified_routes.GetTag,
),
run: fn(http.Conn) -> http.Conn,
) -> Endpoint
Register a GET controller route from one router-indexed verified route.
pub fn get_live(
endpoint: Endpoint,
route: verified_routes.VerifiedRoute(params),
view_id: String,
render: fn(http.Conn) -> String,
) -> Endpoint
Register a GET live route from a verified route helper.
pub fn get_live_indexed(
endpoint: Endpoint,
route: verified_routes.IndexedRoute(
params,
verified_routes.GetTag,
),
view_id: String,
render: fn(http.Conn) -> String,
) -> Endpoint
Register a GET live route from one router-indexed verified route.
pub fn new(
auth_hook: contract.AuthHook,
websocket_path: String,
) -> Endpoint
Create an endpoint.
pub fn pipe(
endpoint: Endpoint,
middleware: fn(http.Conn) -> http.Conn,
) -> Endpoint
Register one middleware in endpoint order.
pub fn route_labels(endpoint: Endpoint) -> List(String)
Stable endpoint route table labels.