mirror of
https://github.com/fafhrd91/actix-web
synced 2025-09-02 01:31:57 +02:00
renamed Route::handler to Route::f, added Route::h to register Handler
This commit is contained in:
@@ -2,7 +2,8 @@
|
||||
|
||||
## Individual file
|
||||
|
||||
It is possible to serve static files with tail path pattern and `NamedFile`.
|
||||
It is possible to serve static files with custom path pattern and `NamedFile`. To
|
||||
match path tail we can use `.*` regex.
|
||||
|
||||
```rust
|
||||
extern crate actix_web;
|
||||
@@ -16,7 +17,7 @@ fn index(req: HttpRequest) -> Result<fs::NamedFile> {
|
||||
|
||||
fn main() {
|
||||
Application::default("/")
|
||||
.resource(r"/a/{tail:*}", |r| r.method(Method::GET).handler(index))
|
||||
.resource(r"/a/{tail:.*}", |r| r.method(Method::GET).f(index))
|
||||
.finish();
|
||||
}
|
||||
```
|
||||
|
Reference in New Issue
Block a user