Add a graphiql instance to /graphiql

This commit is contained in:
Zeph Levy 2025-12-03 22:50:57 +01:00
parent d3d4f2a405
commit a2cdf24589

View file

@ -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));