1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-09-02 01:31:57 +02:00

doc fixes

This commit is contained in:
Nikolay Kim
2017-12-04 16:26:40 -08:00
parent f4e9fc7b6a
commit 2950c90c77
5 changed files with 25 additions and 23 deletions

View File

@@ -3,10 +3,10 @@
## Individual file
It is possible to serve static files with custom path pattern and `NamedFile`. To
match path tail we can use `.*` regex.
match path tail we can use `[.*]` regex.
```rust
extern crate actix_web;
# extern crate actix_web;
use actix_web::*;
use std::path::PathBuf;
@@ -24,15 +24,16 @@ fn main() {
## Directory
To serve files from specific directory and sub-directories `StaticFiles` type could be used.
To serve files from specific directory and sub-directories `StaticFiles` could be used.
`StaticFiles` could be registered with `Application::route` method.
```rust
extern crate actix_web;
# extern crate actix_web;
use actix_web::*;
fn main() {
actix_web::Application::default("/")
.route("/static", |r| r.h(actix_web::fs::StaticFiles::new(".", true)))
Application::default("/")
.route("/static", |r| r.h(fs::StaticFiles::new(".", true)))
.finish();
}
```