灵符lingfu

ling-web

↓ 986 downloads

Sessions, flash, templates, CSRF, static files — Flask-style

Keywords web, flask, sessions, csrf, templates
lingfu install ling-web
LicenseApache-2.0 OR MIT
AuthorsLing Lin, Sanny Lin
READMECode / FilesVersionsDependency GraphDependentsSecurityBuildsSettings

Code / Files (15)

src/static_files.rs
use axum::Router;
use std::path::Path;
use tower_http::services::ServeDir;

/// Mounts a directory of static files at `prefix` (e.g. `serve_static("/static", "./static")`).
pub fn serve_static<S>(prefix: &str, dir: impl AsRef<Path>) -> Router<S>
where
    S: Clone + Send + Sync + 'static,
{
    Router::new().nest_service(prefix, ServeDir::new(dir.as_ref()))
}

← Back to index