mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-24 00:00:16 +02:00
Update to tower-http 0.4 (#1783)
This commit is contained in:
@@ -6,9 +6,8 @@
|
||||
|
||||
use axum::{
|
||||
extract::TypedHeader,
|
||||
http::StatusCode,
|
||||
response::sse::{Event, Sse},
|
||||
routing::{get, get_service},
|
||||
routing::get,
|
||||
Router,
|
||||
};
|
||||
use futures::stream::{self, Stream};
|
||||
@@ -29,15 +28,7 @@ async fn main() {
|
||||
|
||||
let assets_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("assets");
|
||||
|
||||
let static_files_service = get_service(
|
||||
ServeDir::new(assets_dir).append_index_html_on_directories(true),
|
||||
)
|
||||
.handle_error(|error: std::io::Error| async move {
|
||||
(
|
||||
StatusCode::INTERNAL_SERVER_ERROR,
|
||||
format!("Unhandled internal error: {}", error),
|
||||
)
|
||||
});
|
||||
let static_files_service = ServeDir::new(assets_dir).append_index_html_on_directories(true);
|
||||
|
||||
// build our application with a route
|
||||
let app = Router::new()
|
||||
|
||||
Reference in New Issue
Block a user