@conclurer/edel-plugin-apollo v1.0.0-beta.15
Plugin Apollo
@conclurer/edel-plugin-apollo
implements the network plugin defined in @conclurer/edel-core
. The underlaying driver is apollo-client
Using EdelPluginApollo
Plugin needs to be instantiated with
new EdelPluginApollo(apiBasePath: string, mockSchema?: GraphQLSchema)
A valid graphql endpoint needs to be passed to the constructor.
A generated schema can be passed for mocking and testing as second argument.
The Plugin provides basic helpers for the various Edelog Ressources like e.g. Organizations and Items.
These Helpers provide a CRUD Interface with various methods for querying and mutating. Helper Methods will always return all possible fields for an Object.
The Plugin also provides the methods query
and mutate
for running custom GraphQL Queries through it.
Generating Interfaces
apollo-codegen is required for generating the Typescrip Interfaces.
The local GraphQL Schema is stored in schema.json.
Always make sure to generate a fresh representation of the GraphQL Schema with
apollo-codegen introspect-schema http://localhost:5000/api/v3 --output ../../../../schema.json
For generating interfaces run
apollo-codegen generate queries.ts --schema ../../../../schema.json --target typescript --output queries.interfaces.ts
This will generate Interfaces for every gql
tag inside queries.ts
.
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago