1
0
mirror of https://github.com/actix/actix-website synced 2025-06-29 08:14:58 +02:00

Added basic example with includes

This commit is contained in:
Armin Ronacher
2018-05-23 21:28:12 +02:00
parent aebbfbf9db
commit e204566062
6 changed files with 34 additions and 15 deletions

View File

@ -23,21 +23,7 @@ The prefix should consist of value path segments.
> any request with the paths `/app`, `/app/`, or `/app/test` would match;
> however, the path `/application` would not match.
```rust
# extern crate actix_web;
# use actix_web::{App, Responder, HttpRequest, http::Method};
fn index(req: HttpRequest) -> impl Responder {
"Hello world!"
}
fn main() {
let app = App::new()
.prefix("/app")
.resource("/index.html", |r| r.method(Method::GET).f(index))
.finish();
}
```
{{< include-example example="application" section="setup" >}}
In this example, an application with the `/app` prefix and a `index.html` resource
are created. This resource is available through the `/app/index.html` url.