Mercurial > core / rust/bin/alik/graphql.rs
changeset 698: |
96958d3eb5b0 |
parent: |
1816f9c53453
|
author: |
Richard Westhaver <ellis@rwest.io> |
date: |
Fri, 04 Oct 2024 22:04:59 -0400 |
permissions: |
-rw-r--r-- |
description: |
fixes |
1 //! alik/graphql.rs --- Alik GraphQL API Service 7 response::{self, IntoResponse}, 12 use net::http::graphql::http::GraphiQLSource; 13 use tokio::net::TcpListener; 14 // use net::http::graphql::http::{EmptyMutation, EmptySubscription, Schema}; 15 // use net::http::graphql_axum::GraphQL; 17 pub async fn graphiql() -> impl IntoResponse { 18 response::Html(GraphiQLSource::build().endpoint("/").finish()) 21 pub async fn start_graphiql(addr: &str) { 22 // let schema = Schema::build(QueryRoot, EmptyMutation, EmptySubscription) 26 let app = Router::new().route("/", get(graphiql)); 27 // .post_service(GraphQL::new(schema))); 29 let listener = TcpListener::bind(addr).await.unwrap(); 31 "graphiql running on: http://{}", 32 listener.local_addr().unwrap() 34 net::axum::serve(TcpListener::bind(addr).await.unwrap(), app)