Skip to main content

serve_app

Function serve_app 

Source
pub async fn serve_app(app: Router, addr: SocketAddr) -> Result<()>
Expand description

Start the dev-tier services, publish their coordinates into the environment, and serve app until Ctrl+C or SIGTERM. The dev counterpart of mesofact::serve_app, and the whole body of a library-tier project’s src/bin/<name>-dev.rs.

State lands under ./.mesofact-dev, relative to the process’s current directory — the project root, when run via cargo run.

Ordering note. app is already built by the time this is called, so a router() that constructs its object store at construction time has already read an unset R2_ENDPOINT. Handlers that build the store per request (or lazily) are unaffected. If yours reads env eagerly, drive the two halves in order instead:

ⓘ
let dev = mesofact_dev::DevServer::start(".").await?;
dev.export_env();
dev.serve(yah_dashboard::router(), addr).await