http-fs 0.4.0

HTTP File Service library
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use http_fs::config::{self, StaticFileConfig};
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() {
    actix_web::server::new(|| actix_web::App::new().handler("/", StaticFiles::new(DirectoryConfig)).finish()).bind("127.0.0.1:8080").unwrap().run();
}