1
0
mirror of https://github.com/actix/examples synced 2025-06-26 17:17:42 +02:00

update graphql advanced example

This commit is contained in:
Rob Ede
2022-02-17 20:59:04 +00:00
parent 7a3fc52a70
commit e0888cd255
9 changed files with 72 additions and 76 deletions

View File

@ -17,9 +17,9 @@ mod schema;
use crate::schema::{create_schema, Schema};
/// GraphiQL UI
/// GraphiQL playground UI
#[get("/graphiql")]
async fn graphiql() -> impl Responder {
async fn graphql_playground() -> impl Responder {
Html(graphiql_source("/graphql", None))
}
@ -47,7 +47,7 @@ async fn main() -> io::Result<()> {
App::new()
.app_data(Data::from(schema.clone()))
.service(graphql)
.service(graphiql)
.service(graphql_playground)
// the graphiql UI requires CORS to be enabled
.wrap(Cors::permissive())
.wrap(middleware::Logger::default())