Reorganize method routers for handlers and services (#405)

* Re-organize method routing for handlers

* Re-organize method routing for services

* changelog
This commit is contained in:
David Pedersen
2021-10-24 20:05:16 +00:00
committed by GitHub
parent 0ee7379d4f
commit 7692baf837
57 changed files with 743 additions and 742 deletions
+9 -10
View File
@@ -7,9 +7,9 @@
use axum::{
error_handling::HandleErrorExt,
extract::TypedHeader,
handler::get,
http::StatusCode,
response::sse::{Event, Sse},
routing::{get, service_method_router as service},
Router,
};
use futures::stream::{self, Stream};
@@ -25,15 +25,14 @@ async fn main() {
}
tracing_subscriber::fmt::init();
let static_files_service = axum::service::get(
ServeDir::new("examples/sse/assets").append_index_html_on_directories(true),
)
.handle_error(|error: std::io::Error| {
(
StatusCode::INTERNAL_SERVER_ERROR,
format!("Unhandled internal error: {}", error),
)
});
let static_files_service =
service::get(ServeDir::new("examples/sse/assets").append_index_html_on_directories(true))
.handle_error(|error: std::io::Error| {
(
StatusCode::INTERNAL_SERVER_ERROR,
format!("Unhandled internal error: {}", error),
)
});
// build our application with a route
let app = Router::new()