async-graphql/docs/en/src/integrations_to_poem.md
Edward Rudd 3b7ed74d11 correct doc examples so they compile
- examples to fix still
  - error_extensions.md ResultExt example does not compile!
     - trait ErrorExtensions is not implemented for ParseIntError
  - dataloader
     - requires sqlx to work. So we either "stub" it OR we rewrite them simpler to use a  simple "faux" db library
2022-06-02 17:32:12 -04:00

1002 B

Poem

Request example

# extern crate async_graphql_poem;
# extern crate async_graphql;
# extern crate poem;
# use async_graphql::*;
# #[derive(Default, SimpleObject)]
# struct Query { a: i32 }
# let schema = Schema::build(Query::default(), EmptyMutation, EmptySubscription).finish();
use poem::Route;
use async_graphql_poem::GraphQL;

let app = Route::new()
    .at("/ws", GraphQL::new(schema));

Subscription example

# extern crate async_graphql_poem;
# extern crate async_graphql;
# extern crate poem;
# use async_graphql::*;
# #[derive(Default, SimpleObject)]
# struct Query { a: i32 }
# let schema = Schema::build(Query::default(), EmptyMutation, EmptySubscription).finish();
use poem::{get, Route};
use async_graphql_poem::GraphQLSubscription;

let app = Route::new()
    .at("/ws", get(GraphQLSubscription::new(schema)));

More examples

https://github.com/async-graphql/examples/tree/master/poem