with graphql
This commit is contained in:
@@ -3,8 +3,7 @@ use async_graphql::{Context, EmptySubscription, Object, Schema};
|
||||
use como_domain::item::{requests::CreateItemDto, responses::CreatedItemDto};
|
||||
use como_infrastructure::register::ServiceRegister;
|
||||
|
||||
|
||||
pub type CibusSchema = Schema<QueryRoot, MutationRoot, EmptySubscription>;
|
||||
pub type ComoSchema = Schema<QueryRoot, MutationRoot, EmptySubscription>;
|
||||
|
||||
pub struct MutationRoot;
|
||||
|
||||
|
@@ -1,30 +1,17 @@
|
||||
use async_graphql_axum::{GraphQLRequest, GraphQLResponse};
|
||||
use axum::{
|
||||
extract::Extension,
|
||||
http::{StatusCode},
|
||||
http::StatusCode,
|
||||
response::{Html, IntoResponse},
|
||||
};
|
||||
|
||||
|
||||
use async_graphql::{
|
||||
http::{playground_source, GraphQLPlaygroundConfig},
|
||||
};
|
||||
use axum_sessions::{
|
||||
extractors::{ReadableSession},
|
||||
};
|
||||
use graphql::CibusSchema;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
use async_graphql::http::{playground_source, GraphQLPlaygroundConfig};
|
||||
use graphql::ComoSchema;
|
||||
|
||||
pub mod graphql;
|
||||
|
||||
pub async fn graphql_handler(
|
||||
schema: Extension<CibusSchema>,
|
||||
_session: ReadableSession,
|
||||
schema: Extension<ComoSchema>,
|
||||
req: GraphQLRequest,
|
||||
) -> Result<GraphQLResponse, StatusCode> {
|
||||
let req = req.into_inner();
|
||||
@@ -33,5 +20,5 @@ pub async fn graphql_handler(
|
||||
}
|
||||
|
||||
pub async fn graphql_playground() -> impl IntoResponse {
|
||||
Html(playground_source(GraphQLPlaygroundConfig::new("/")))
|
||||
Html(playground_source(GraphQLPlaygroundConfig::new("/graphql")))
|
||||
}
|
||||
|
Reference in New Issue
Block a user