Something went wrong. Try again.
unified development activity
Something went wrong. Try again.
735 B · 22 lines
Rust
at main
1234567891011121314151617181920212223//! Local preview server. The deployed site is static files on S3 and//! CloudFront; this exists so `tally serve` shows exactly those files.
use std::path::PathBuf;
use anyhow::Result;use tower_http::services::ServeDir;
pub async fn run(dir: PathBuf, bind: &str) -> Result<()> { let app = axum::Router::new() .route("/healthz", axum::routing::get(|| async { "ok" })) .fallback_service( ServeDir::new(&dir) .append_index_html_on_directories(true) .precompressed_gzip(), );
let listener = tokio::net::TcpListener::bind(bind).await?; tracing::info!(%bind, dir = %dir.display(), "serving dashboard"); axum::serve(listener, app).await?; Ok(())}