pub struct App { /* private fields */ }Implementations§
Source§impl App
impl App
pub fn new() -> Self
pub fn bind(self, addr: impl Into<String>) -> Self
Sourcepub fn config(self, config: Config) -> Self
pub fn config(self, config: Config) -> Self
Configuration available to every action as ctx.config.
Sourcepub fn middleware<M: Middleware>(self, middleware: M) -> Self
pub fn middleware<M: Middleware>(self, middleware: M) -> Self
Middleware applied to every route, outermost first.
pub fn routes(self, register: impl FnOnce(&mut Router)) -> Self
Sourcepub fn route_table(&self) -> Vec<RouteInfo>
pub fn route_table(&self) -> Vec<RouteInfo>
The resolved routing table. Backs luxid routes, so an unexpected 404
is answerable without reading the source.
Sourcepub fn openapi(&self, title: &str, version: &str) -> Value
pub fn openapi(&self, title: &str, version: &str) -> Value
The OpenAPI 3.1 document for this application’s routes.
Sourcepub fn into_service(self) -> Service
pub fn into_service(self) -> Service
Build the service without binding a port, so tests exercise the same routing, container and adapter code as production.
This deliberately skips eager singleton resolution: a test that binds
only the services it needs should not have to satisfy the whole
application graph. Use App::try_into_service when you want that
validation.
Sourcepub fn try_into_service(self) -> Result<Service>
pub fn try_into_service(self) -> Result<Service>
As App::into_service, but validates the provider graph first.
pub async fn run(self) -> Result<()>
Sourcepub fn into_parts(self) -> (Router, Container)
pub fn into_parts(self) -> (Router, Container)
The router and container this app assembles into.
The CLI needs the container to reach the database without starting a server.