diff options
author | David Pedersen <david.pdrsn@gmail.com> | 2021-08-19 22:37:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-19 22:37:48 +0200 |
commit | ca4d9a2bb99746c291ca8ad28dd0c5574fa46893 (patch) | |
tree | 33f6afcf73dd8b7e7d576ac410a8885a0139427d /examples/multipart-form | |
parent | 97b53768ba7fec445a5ea91ae7299790a68bf459 (diff) |
Replace `route` with `Router::new().route()` (#215)
This way there is now only one way to create a router:
```rust
use axum::{Router, handler::get};
let app = Router::new()
.route("/foo", get(handler))
.route("/foo", get(handler));
```
`nest` was changed in the same way:
```rust
use axum::Router;
let app = Router::new().nest("/foo", service);
```
Diffstat (limited to 'examples/multipart-form')
-rw-r--r-- | examples/multipart-form/src/main.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/examples/multipart-form/src/main.rs b/examples/multipart-form/src/main.rs index cd6017ef..3371eb48 100644 --- a/examples/multipart-form/src/main.rs +++ b/examples/multipart-form/src/main.rs @@ -8,7 +8,7 @@ use axum::{ extract::{ContentLengthLimit, Multipart}, handler::get, response::Html, - route, + Router, }; use std::net::SocketAddr; @@ -21,7 +21,8 @@ async fn main() { tracing_subscriber::fmt::init(); // build our application with some routes - let app = route("/", get(show_form).post(accept_form)) + let app = Router::new() + .route("/", get(show_form).post(accept_form)) .layer(tower_http::trace::TraceLayer::new_for_http()); // run it with hyper |