You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
and the error here
the trait bound fn(axum::extract::State<async_graphql::Schema<QueryRoot, schema::Mutation, EmptySubscription>>, HeaderMap, GraphQLRequest) -> impl std::future::Future<Output = GraphQLResponse> {graphql_handler}: Handler<_, _> is not satisfied
--> src\main.rs:89:33
|
89 | .route("/graphql", post(graphql_handler))
| ---- ^^^^^^^^^^^^^^^ the trait Handler<_, _> is not implemented for fn item fn(axum::extract::State<async_graphql::Schema<QueryRoot, schema::Mutation, EmptySubscription>>, HeaderMap, GraphQLRequest) -> impl std::future::Future<Output = GraphQLResponse> {graphql_handler}
| |
| required by a bound introduced by this call
|
= help: the following other types implement trait Handler<T, S>:
<Layered<L, H, T, S> as Handler<T, S>>
<MethodRouter as Handler<(), S>>
note: required by a bound in post
The text was updated successfully, but these errors were encountered:
I'm new to rust and
I'am facing error in post request.
axum 7
type MySchema = Schema<QueryRoot, Mutation, EmptySubscription>;
async fn graphql_handler(
schema: State,
_headers: HeaderMap,
request: GraphQLRequest,
) -> GraphQLResponse {
schema.execute(request.0).await.into()
}
let app = Router::new()
.route("/api/healthchecker", post(health_checker_handler))
.route("/graphql", post(graphql_handler))
.route("/playground", get(graphql_playground))
.with_state(schema.clone())
.layer(
CorsLayer::new()
.allow_origin("http://localhost:3000".parse::().unwrap())
.allow_methods([Method::GET, Method::POST, Method::PATCH, Method::DELETE]),
);
and the error here
the trait bound
fn(axum::extract::State<async_graphql::Schema<QueryRoot, schema::Mutation, EmptySubscription>>, HeaderMap, GraphQLRequest) -> impl std::future::Future<Output = GraphQLResponse> {graphql_handler}: Handler<_, _>
is not satisfied--> src\main.rs:89:33
|
89 | .route("/graphql", post(graphql_handler))
| ---- ^^^^^^^^^^^^^^^ the trait
Handler<_, _>
is not implemented for fn itemfn(axum::extract::State<async_graphql::Schema<QueryRoot, schema::Mutation, EmptySubscription>>, HeaderMap, GraphQLRequest) -> impl std::future::Future<Output = GraphQLResponse> {graphql_handler}
| |
| required by a bound introduced by this call
|
= help: the following other types implement trait
Handler<T, S>
:<Layered<L, H, T, S> as Handler<T, S>>
<MethodRouter
as Handler<(), S>>note: required by a bound in
post
The text was updated successfully, but these errors were encountered: