Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

content/docs/static-files.md contains an incorrect example #71

Closed
icefoxen opened this issue Jan 22, 2019 · 1 comment
Closed

content/docs/static-files.md contains an incorrect example #71

icefoxen opened this issue Jan 22, 2019 · 1 comment

Comments

@icefoxen
Copy link

icefoxen commented Jan 22, 2019

For example, the directory example:

use actix_web::{App, fs};

fn main() {
    App::new()
        .handler(
            "/static",
            fs::StaticFiles::new(".")
                .unwrap()
                .show_files_listing())
        .finish();
}

Needs to actually run a server to do anything:

use actix_web::{App, fs, server};

fn main() {
    server::new(|| App::new()
        .handler(
            "/static",
            fs::StaticFiles::new(".")
                .unwrap()
                .show_files_listing()))
        .bind("127.0.0.1:8888")
        .expect("Can not bind to port 8888")
        .run()
}

Lots of other examples have the same problem, in various chapters. I sympathize with wanting to keep noise low, but I would argue you also want your examples to either actually do something when run, or not compile.

@cldershem
Copy link
Member

This has been fixed with 9fcd8c1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants