armature-graphql

Crates.ioarmature-graphql
lib.rsarmature-graphql
version0.2.0
created_at2025-12-26 21:15:55.52059+00
updated_at2025-12-29 01:05:16.297779+00
descriptionGraphQL server integration for Armature
homepagehttps://pegasusheavy.github.io/armature
repositoryhttps://github.com/pegasusheavy/armature
max_upload_size
id2006281
size147,781
Joseph R. Quinn (quinnjr)

documentation

README

armature-graphql

GraphQL support for the Armature framework.

Features

  • Schema Definition - Type-safe GraphQL schemas
  • Resolvers - Async resolver functions
  • Subscriptions - Real-time updates via WebSocket
  • Playground - Built-in GraphQL IDE
  • Validation - Query validation and depth limiting

Installation

[dependencies]
armature-graphql = "0.1"

Quick Start

use armature_graphql::{GraphQLSchema, Query, Mutation};

struct QueryRoot;

#[Query]
impl QueryRoot {
    async fn hello(&self) -> &str {
        "Hello, World!"
    }

    async fn user(&self, id: ID) -> Option<User> {
        User::find(id).await
    }
}

#[tokio::main]
async fn main() {
    let schema = GraphQLSchema::build(QueryRoot, MutationRoot, EmptySubscription)
        .finish();

    let app = Application::new()
        .post("/graphql", graphql_handler(schema))
        .get("/playground", playground_handler());

    app.listen("0.0.0.0:3000").await.unwrap();
}

Subscriptions

struct SubscriptionRoot;

#[Subscription]
impl SubscriptionRoot {
    async fn messages(&self) -> impl Stream<Item = Message> {
        // Return a stream of messages
    }
}

License

MIT OR Apache-2.0

Commit count: 0

cargo fmt