| Crates.io | armature-graphql |
| lib.rs | armature-graphql |
| version | 0.2.0 |
| created_at | 2025-12-26 21:15:55.52059+00 |
| updated_at | 2025-12-29 01:05:16.297779+00 |
| description | GraphQL server integration for Armature |
| homepage | https://pegasusheavy.github.io/armature |
| repository | https://github.com/pegasusheavy/armature |
| max_upload_size | |
| id | 2006281 |
| size | 147,781 |
GraphQL support for the Armature framework.
[dependencies]
armature-graphql = "0.1"
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();
}
struct SubscriptionRoot;
#[Subscription]
impl SubscriptionRoot {
async fn messages(&self) -> impl Stream<Item = Message> {
// Return a stream of messages
}
}
MIT OR Apache-2.0