Function lib::create_graphql_server [−][src]
pub fn create_graphql_server<C, Q, M, S>(
opts: Options<C, Q, M, S>
) -> Result<impl FnOnce(&mut ServiceConfig) + Clone> where
C: Any + Send + Sync + Clone,
Q: Clone + ObjectType + 'static,
M: Clone + ObjectType + 'static,
S: Clone + SubscriptionType + 'static,
Expand description
Creates a configuration handler to create a new GraphQL server for queries and mutations.
The resulting server will not support subscriptions, you should use create_subscriptions_server for that.
Example
use diana::{create_graphql_server, App, HttpServer}; let configurer = create_graphql_server(opts).expect("Failed to set up configurer."); HttpServer::new(move || App::new().configure(configurer.clone())) .bind("0.0.0.0:7000")? .run() .await
The result of this should (as in the above example) be used as an argument in actix_web’s App.configure() function. Diana re-exports
the basics of Actix Web, so you don’t have to install it for basic usage.