mirror of
https://github.com/fafhrd91/actix-web
synced 2025-09-02 01:31:57 +02:00
doc fixes
This commit is contained in:
@@ -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();
|
||||
}
|
||||
```
|
||||
|
Reference in New Issue
Block a user