Add a graphiql instance to /graphiql
This commit is contained in:
parent
d3d4f2a405
commit
a2cdf24589
1 changed files with 6 additions and 0 deletions
|
|
@ -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));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue