We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I found error in example (It doesn't work) actix-web-subscription. For fixing it, you need to paste this code (changes in one line). Code:
use actix_web::{guard, web, App, HttpRequest, HttpResponse, HttpServer, Result}; use async_graphql::{http::GraphiQLSource, Schema}; use async_graphql_actix_web::{GraphQL, GraphQLSubscription}; use books::{BooksSchema, MutationRoot, QueryRoot, Storage, SubscriptionRoot}; async fn index_graphiql() -> Result<HttpResponse> { Ok(HttpResponse::Ok() .content_type("text/html; charset=utf-8") .body( GraphiQLSource::build() .endpoint("/") .subscription_endpoint("/") .finish(), )) } async fn index_ws( schema: web::Data<BooksSchema>, req: HttpRequest, payload: web::Payload, ) -> Result<HttpResponse> { GraphQLSubscription::new(Schema::clone(&*schema)).start(&req, payload) } #[actix_web::main] async fn main() -> std::io::Result<()> { println!("GraphiQL IDE: http://localhost:8000"); HttpServer::new(move || { let schema = Schema::build(QueryRoot, MutationRoot, SubscriptionRoot) .data(Storage::default()) .finish(); App::new() .app_data(web::Data::new(schema.clone())) .service( web::resource("/") .guard(guard::Post()) .to(GraphQL::new(schema)), ) .service( web::resource("/") .guard(guard::Get()) .guard(guard::Header("upgrade", "websocket")) .to(index_ws), ) .service(web::resource("/").guard(guard::Get()).to(index_graphiql)) }) .bind("127.0.0.1:8000")? .run() .await }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I found error in example (It doesn't work) actix-web-subscription.
For fixing it, you need to paste this code (changes in one line).
Code:
The text was updated successfully, but these errors were encountered: