From a2cdf24589e9e0adb65e2929a7b4f58477d3be7f Mon Sep 17 00:00:00 2001 From: Zeph Levy <171337931+ZephLevy@users.noreply.github.com> Date: Wed, 3 Dec 2025 22:50:57 +0100 Subject: [PATCH] Add a graphiql instance to `/graphiql` --- src/main.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main.rs b/src/main.rs index b631822..8673104 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,8 @@ +use async_graphql::http::GraphiQLSource; use async_graphql_axum::{GraphQLRequest, GraphQLResponse}; use axum::{ Router, + response::Html, routing::{get, post}, }; use std::net::SocketAddr; @@ -29,6 +31,10 @@ async fn main() -> anyhow::Result<()> { let schema = schema.clone(); move || async move { axum::Json(schema.sdl()) } }), + ) + .route( + "/graphiql", + get(Html(GraphiQLSource::build().endpoint("/graphql").finish())), ); let addr = SocketAddr::from(([0, 0, 0, 0], 3000));