1
0
mirror of https://github.com/actix/actix-website synced 2025-02-08 22:36:07 +01:00

Merge pull request #38 from DD5HT/master

Fixed missing unwraps and added some consistency
This commit is contained in:
Nikolay Kim 2018-07-22 12:50:36 -07:00 committed by GitHub
commit 0c2153597f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,6 +10,7 @@ It is possible to serve static files with a custom path pattern and `NamedFile`.
match a path tail, we can use a `[.*]` regex. match a path tail, we can use a `[.*]` regex.
```rust ```rust
extern crate actix_web;
use std::path::PathBuf; use std::path::PathBuf;
use actix_web::{App, HttpRequest, Result, http::Method, fs::NamedFile}; use actix_web::{App, HttpRequest, Result, http::Method, fs::NamedFile};
@ -32,6 +33,7 @@ To serve files from specific directories and sub-directories, `StaticFiles` can
it will be unable to serve sub-paths. it will be unable to serve sub-paths.
```rust ```rust
extern crate actix_web;
use actix_web::{App, fs}; use actix_web::{App, fs};
fn main() { fn main() {
@ -39,6 +41,7 @@ fn main() {
.handler( .handler(
"/static", "/static",
fs::StaticFiles::new(".") fs::StaticFiles::new(".")
.unwrap()
.show_files_listing()) .show_files_listing())
.finish(); .finish();
} }
@ -123,7 +126,7 @@ fn main() {
App::new() App::new()
.handler( .handler(
"/static", "/static",
StaticFiles::with_config(".", MyConfig) StaticFiles::with_config(".", MyConfig).unwrap()
.show_files_listing() .show_files_listing()
).finish(); ).finish();
} }