Skip to main content

Module adapters

Module adapters 

Source
Expand description

The routes as a tower Service, for hyper, axum, and most Rust HTTP stacks (node.ts’s adapter, for Rust): the request read into a runlight::http::Request, with its body capped, and the answer written back as an http::Response.

Modules§

axum_support
axum: the routes mounted at their base path and the short links at their link path, as one Router to merge into the app’s. A router only sees the paths it routes, so link domains, whose short links sit at the root of their own name, and AI agent fetches go through middleware, which runs before the app’s own routes.

Structs§

LinkService
Short links on the app’s own domain, {link_path}/{slug}, as a tower Service. It is what the app routes its link path to, so it answers every request it is handed: a link domain’s first (where the link path is a path with no link, a 404), then the link’s redirect, or Runlight’s own 404 for a slug with no link. A router has already matched the path by then and cannot hand it on to the app’s fallback, so the app’s own 404 page does not show there.

Functions§

to_http
Runlight’s answer as an http::Response.
to_request
An http::Request as Runlight’s, its body read whole up to the cap. Err is the answer when the body is too large.