11 releases (3 stable)

2.0.1 Nov 16, 2023
2.0.0-alpha.2 Sep 16, 2023
1.0.0 Aug 22, 2019
0.5.0 Apr 5, 2019
0.1.0 Mar 5, 2019

#431 in HTTP server

Apache-2.0

61KB
1K SLoC

http-fs

Build Crates.io Documentation

Features

  • tokio - Enables tokio runtime integration. Enables rt.
  • hyper - Enables hyper integration. Enables http1 and server features.

lib.rs:

http-fs

Features

  • tokio - Enables tokio runtime integration. Enables rt.
  • hyper - Enables hyper integration. Enables http1 and server features.

Usage

use http_fs::config::{self, StaticFileConfig, DummyWorker};
use http_fs::{StaticFiles};

use std::path::Path;

pub struct DirectoryConfig;
impl StaticFileConfig for DirectoryConfig {
    type FileService = config::DefaultConfig;
    type DirService = config::DefaultConfig;

    fn handle_directory(&self, _path: &Path) -> bool {
        true
    }
}

fn main() {
    let static_files = StaticFiles::new(DummyWorker, DirectoryConfig);
}

Dependencies

~1–2.5MB
~45K SLoC