mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-26 00:00:23 +02:00
Add RouteDsl::or to combine routes (#108)
With this you'll be able to do:
```rust
let one = route("/foo", get(|| async { "foo" }))
.route("/bar", get(|| async { "bar" }));
let two = route("/baz", get(|| async { "baz" }));
let app = one.or(two);
```
Fixes https://github.com/tokio-rs/axum/issues/101
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
#![allow(clippy::blacklisted_name)]
|
||||
|
||||
use crate::{
|
||||
extract::RequestParts, handler::on, prelude::*, routing::nest, routing::MethodFilter, service,
|
||||
};
|
||||
@@ -18,6 +20,7 @@ use tower::{make::Shared, service_fn, BoxError, Service, ServiceBuilder};
|
||||
use tower_http::{compression::CompressionLayer, trace::TraceLayer};
|
||||
|
||||
mod nest;
|
||||
mod or;
|
||||
|
||||
#[tokio::test]
|
||||
async fn hello_world() {
|
||||
|
||||
Reference in New Issue
Block a user