sova-graphql 0.1.2

GraphQL client (+ optional schema mount) for Sova
Documentation

crates.io docs.rs License

sova-graphql

GraphQL for Sova: outbound HTTP client (req.graphql()), optional schema server (GraphiQL, subscriptions, GraphqlContext).

Part of Sova.

Guide: https://s00d.github.io/sova/plugins/graphql

Features

Feature Description
client (default) Outbound HTTP client + FakeGraphql
server Schema mount, GraphiQL, WebSocket subscriptions, resolver context

Install

# Server + client
cargo add sova --features graphql-server

# Client only
cargo add sova --features graphql

Server (3 steps)

use async_graphql::{Object, Schema};
use sova::GraphQl;

#[Object]
impl Query { async fn hello(&self) -> &str { "world" } }

let schema = Schema::build(Query, async_graphql::EmptyMutation, async_graphql::EmptySubscription).finish();
app.install(GraphQl::server(schema).graphiql(true));

Resolvers: ctx.data::<sova::GraphqlContext>()?.state::<YourState>().

License

MIT — see LICENSE.