use std::io; use crate::{prelude::*, tailwind}; use axum::{serve, Router}; #[instrument(skip(router))] pub async fn webserver( router: Router, with_watchers: bool, host: Option<&str>, port: Option, ) -> Result<(), io::Error> { if with_watchers { tokio::spawn(async move { tailwind::start_watcher() }); } let listener = tokio::net::TcpListener::bind((host.unwrap_or("::1"), port.unwrap_or(3000))) .await .unwrap(); let addr = listener.local_addr()?; info!(%addr); Ok(serve(listener, router).await?) }