Static-FS
“Volo-HTTP Static-FS”
Volo-HTTP provides the ServeDir
function for registering static files.
use volo_http::server::{
route::{get, Router},
utils::ServeDir,
};
async fn file_router() -> Router {
Router::new()
.route("/", get(|| async {"Hello, World!"}))
.nest_service("/static/", ServeDir::new("."))
}
where the ServeDir::new
parameter specifies the path to be transmitted
”.”
means transferring all files in the current command execution path.
Last modified
June 23, 2025
: fix: 同步 Volo-gRPC Volo-Thrift 教程的 Cargo.toml 示例到官方volo init命令生成的 Cargo.toml (#1359) (9c7fb3a)