Im using axum and seaorm for my backend. i got an error with CORS.
I tried to use cors layer
let cors = CorsLayer::new()
.allow_methods([Method::GET,Method::POST])
.allow_origin(Any);
let app: Router = Router::new()
.route("/posts", get(list_posts).post(create_posts))
.route("/tasks", get(list_tasks).post(create_tasks))
.layer(cors)
.with_state(state);
but got the trait bound `Cors<axum::routing::Route<_>>: Service<axum::http::Request<_>>` is not satisfied the trait `Service<http::Request<ReqBody>>` is implemented for `Cors<S>
I dont have any idea how to fix it. I googled it, but all the other codes work well.
1