tower = { vesion = "0.4.13", features = ["full"] }
tower-http = { vesion = "0.5.0", features = ["full"] }
Platform
Manjaro Linux x86_64
Crates
tower-http, tower, axum
Description
I am trying to set up basic middleware, and I am receiving errors.
use axum::{
routing::get,
Router,
};
use tower_http::trace::TraceLayer;
pub mod routes;
#[tokio::main]
async fn main() {
let app = Router::new()
.route("/test/hello", get(routes::hello))
.layer(TraceLayer::new_for_http());
println!("Server is running on port localhost:3000");
axum::Server::bind(&"0.0.0.0:3000".parse().unwrap())
.serve(app.into_make_service())
.await
.unwrap();
}
The error says the following, on the .layer() line: the trait bound 'Trace<Route<_>, SharedClassifier<ServerErrorsAsFailures>>: Service<axum::http::Request<_>>' is not satisfied the trait 'Service<http::request::Request<ReqBody>>' is implemented for 'Trace<S, M, MakeSpanT, OnRequestT, OnResponseT, OnBodyChunkT, OnEosT, OnFailureT>'
Bug Report
Version
tower = { vesion = "0.4.13", features = ["full"] } tower-http = { vesion = "0.5.0", features = ["full"] }
Platform
Manjaro Linux x86_64
Crates
tower-http, tower, axum
Description
I am trying to set up basic middleware, and I am receiving errors.
The error says the following, on the .layer() line:
the trait bound 'Trace<Route<_>, SharedClassifier<ServerErrorsAsFailures>>: Service<axum::http::Request<_>>' is not satisfied the trait 'Service<http::request::Request<ReqBody>>' is implemented for 'Trace<S, M, MakeSpanT, OnRequestT, OnResponseT, OnBodyChunkT, OnEosT, OnFailureT>'