mirror of
https://github.com/actix/examples
synced 2025-01-22 22:05:57 +01:00
Removing namespace usage for clarity (#369)
This commit is contained in:
parent
b727e796b9
commit
95319754a1
@ -1,5 +1,3 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use actix_web::{web, Error, HttpResponse};
|
||||
use juniper::http::graphiql::graphiql_source;
|
||||
use juniper::http::GraphQLRequest;
|
||||
@ -9,7 +7,7 @@ use crate::schemas::root::{create_schema, Context, Schema};
|
||||
|
||||
pub async fn graphql(
|
||||
pool: web::Data<Pool>,
|
||||
schema: web::Data<Arc<Schema>>,
|
||||
schema: web::Data<Schema>,
|
||||
data: web::Json<GraphQLRequest>,
|
||||
) -> Result<HttpResponse, Error> {
|
||||
let ctx = Context {
|
||||
@ -34,9 +32,8 @@ pub async fn graphql_playground() -> HttpResponse {
|
||||
}
|
||||
|
||||
pub fn register(config: &mut web::ServiceConfig) {
|
||||
let schema = std::sync::Arc::new(create_schema());
|
||||
config
|
||||
.data(schema)
|
||||
.data(create_schema())
|
||||
.route("/graphql", web::post().to(graphql))
|
||||
.route("/graphiql", web::get().to(graphql_playground));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user