Struct juniper_iron::GraphQLHandler [−][src]
pub struct GraphQLHandler<'a, CtxFactory, Query, Mutation, CtxT> where
CtxFactory: Fn(&mut Request) -> IronResult<CtxT> + Send + Sync + 'static,
CtxT: 'static,
Query: GraphQLType<Context = CtxT> + Send + Sync + 'static,
Mutation: GraphQLType<Context = CtxT> + Send + Sync + 'static, { /* fields omitted */ }
Handler that executes GraphQL
queries in the given schema
The handler responds to GET requests and POST requests only. In GET
requests, the query should be supplied in the query
URL parameter, e.g.
http://localhost:3000/graphql?query={hero{name}}
.
POST requests support both queries and variables. POST a JSON document to
this endpoint containing the field "query"
and optionally "variables"
.
The variables should be a JSON object containing the variable to value
mapping.
Methods
impl<'a, CtxFactory, Query, Mutation, CtxT> GraphQLHandler<'a, CtxFactory, Query, Mutation, CtxT> where
CtxFactory: Fn(&mut Request) -> IronResult<CtxT> + Send + Sync + 'static,
CtxT: 'static,
Query: GraphQLType<Context = CtxT, TypeInfo = ()> + Send + Sync + 'static,
Mutation: GraphQLType<Context = CtxT, TypeInfo = ()> + Send + Sync + 'static,
[src]
impl<'a, CtxFactory, Query, Mutation, CtxT> GraphQLHandler<'a, CtxFactory, Query, Mutation, CtxT> where
CtxFactory: Fn(&mut Request) -> IronResult<CtxT> + Send + Sync + 'static,
CtxT: 'static,
Query: GraphQLType<Context = CtxT, TypeInfo = ()> + Send + Sync + 'static,
Mutation: GraphQLType<Context = CtxT, TypeInfo = ()> + Send + Sync + 'static,
pub fn new(
context_factory: CtxFactory,
query: Query,
mutation: Mutation
) -> Self
[src]
pub fn new(
context_factory: CtxFactory,
query: Query,
mutation: Mutation
) -> Self
Build a new GraphQL handler
The context factory will receive the Iron request object and is expected to construct a context object for the given schema. This can be used to construct e.g. database connections or similar data that the schema needs to execute the query.
Trait Implementations
impl<'a, CtxFactory, Query, Mutation, CtxT> Handler for GraphQLHandler<'a, CtxFactory, Query, Mutation, CtxT> where
CtxFactory: Fn(&mut Request) -> IronResult<CtxT> + Send + Sync + 'static,
CtxT: 'static,
Query: GraphQLType<Context = CtxT, TypeInfo = ()> + Send + Sync + 'static,
Mutation: GraphQLType<Context = CtxT, TypeInfo = ()> + Send + Sync + 'static,
'a: 'static,
[src]
impl<'a, CtxFactory, Query, Mutation, CtxT> Handler for GraphQLHandler<'a, CtxFactory, Query, Mutation, CtxT> where
CtxFactory: Fn(&mut Request) -> IronResult<CtxT> + Send + Sync + 'static,
CtxT: 'static,
Query: GraphQLType<Context = CtxT, TypeInfo = ()> + Send + Sync + 'static,
Mutation: GraphQLType<Context = CtxT, TypeInfo = ()> + Send + Sync + 'static,
'a: 'static,
fn handle(&self, req: &mut Request) -> IronResult<Response>
[src]
fn handle(&self, req: &mut Request) -> IronResult<Response>
Produce a Response
from a Request, with the possibility of error.
Auto Trait Implementations
impl<'a, CtxFactory, Query, Mutation, CtxT> Send for GraphQLHandler<'a, CtxFactory, Query, Mutation, CtxT> where
<Mutation as GraphQLType>::TypeInfo: Send,
<Query as GraphQLType>::TypeInfo: Send,
impl<'a, CtxFactory, Query, Mutation, CtxT> Send for GraphQLHandler<'a, CtxFactory, Query, Mutation, CtxT> where
<Mutation as GraphQLType>::TypeInfo: Send,
<Query as GraphQLType>::TypeInfo: Send,
impl<'a, CtxFactory, Query, Mutation, CtxT> Sync for GraphQLHandler<'a, CtxFactory, Query, Mutation, CtxT> where
<Mutation as GraphQLType>::TypeInfo: Sync,
<Query as GraphQLType>::TypeInfo: Sync,
impl<'a, CtxFactory, Query, Mutation, CtxT> Sync for GraphQLHandler<'a, CtxFactory, Query, Mutation, CtxT> where
<Mutation as GraphQLType>::TypeInfo: Sync,
<Query as GraphQLType>::TypeInfo: Sync,