#noogen #simple #static #http #server

tiny_file_server

The simplest file server for the web development purposes

5 releases

0.1.4 Dec 10, 2021
0.1.3 Feb 5, 2021
0.1.2 Feb 5, 2021
0.1.1 Jan 7, 2021
0.1.0 Dec 18, 2020

#195 in HTTP server

31 downloads per month

MIT license

8KB
116 lines

Tiny file server

The simplest file server for web development purposes.

use env_logger::{Builder, Env};
use tiny_file_server::FileServer;

fn main() {
    Builder::from_env(Env::default().default_filter_or("debug")).init();

    FileServer::http("127.0.0.1:9080")
        .expect("Server should be created")
        .run("path/to/static/files")
        .expect("Server should start");
}

Development notes

To check the project, use the following command:

cargo check --all-features --all-targets

To run all tests, use the following command:

cargo test --all-features --all-targets

To check and perform formatting, use the following commands:

cargo +nightly fmt -- --check
cargo +nightly fmt

To enable autoformatting for IntelliJ IDEA with the Rust plugin:

File -> Settings -> Languages & Frameworks -> Rust -> Rustfmt, check "Run rustfmt on Save"

To run clippy, use the following command:

cargo clippy --all-targets --all-features -- -D warnings

To setup git hook, use the following command:

cp .git-pre-push.sh .git/hooks/pre-push

Dependencies

~3.5MB
~88K SLoC