New method router (#521)

* Empty crate

* basic setup

* Support `HEAD`

* Add remaining methods

* Impl Debug

* Add `MethodRouter::merge`

* WIP

* Support same route with different methods in different calls

* Update changelog

* Bring back `any` and `any_service`

* Address review feedback
This commit is contained in:
David Pedersen
2021-11-16 20:49:07 +01:00
committed by GitHub
parent 3cf8ee3b5e
commit 2bd0310463
25 changed files with 1533 additions and 803 deletions
+2 -3
View File
@@ -7,14 +7,13 @@
//! ```
use axum::{
error_handling::HandleErrorExt,
extract::{
ws::{Message, WebSocket, WebSocketUpgrade},
TypedHeader,
},
http::StatusCode,
response::IntoResponse,
routing::{get, service_method_routing as service},
routing::{get, get_service},
Router,
};
use std::net::SocketAddr;
@@ -34,7 +33,7 @@ async fn main() {
// build our application with some routes
let app = Router::new()
.fallback(
service::get(
get_service(
ServeDir::new("examples/websockets/assets").append_index_html_on_directories(true),
)
.handle_error(|error: std::io::Error| {