1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// FIXME: remove this feature gate as soon as the rustc version used in docs.rs is updated
//! A set of extensions for supporting Juniper integration.
//!
//! # Examples
//!
//! ```
//! #[macro_use]
//! extern crate finchers;
//! # use finchers::prelude::*;
//! extern crate finchers_juniper;
//! #[macro_use]
//! extern crate juniper;
//!
//! use juniper::{EmptyMutation, RootNode};
//!
//! // The contextual information used when GraphQL query executes.
//! //
//! // Typically it contains a connection retrieved from pool
//! // or credential information extracted from HTTP headers.
//! struct MyContext {
//! // ...
//! }
//! impl juniper::Context for MyContext {}
//!
//! struct Query {}
//! graphql_object!(Query: MyContext |&self| {
//! field apiVersion() -> &str { "1.0" }
//! // ...
//! });
//!
//! # fn main() {
//! let schema = RootNode::new(
//! Query {},
//! EmptyMutation::<MyContext>::new(),
//! );
//!
//! // An endpoint which acquires a GraphQL context from request.
//! let fetch_graphql_context =
//! endpoint::unit().map(|| MyContext { /* ... */ });
//!
//! // Build an endpoint which handles GraphQL requests.
//! let endpoint = path!(@get / "graphql" /)
//! .and(fetch_graphql_context)
//! .wrap(finchers_juniper::execute::nonblocking(schema));
//! # drop(move || {
//! # finchers::server::start(endpoint).serve("127.0.0.1:4000")
//! # });
//! # }
//! ```
// #![warn(rust_2018_compatibility)]
extern crate bytes;
extern crate failure;
extern crate finchers;
extern crate futures;
extern crate juniper;
extern crate log;
extern crate percent_encoding;
extern crate serde;
extern crate http;
extern crate serde_json;
extern crate serde_qs;
extern crate matches;
pub use graphiql_source;
pub use graphql_request;