Graphql schema url with apollo client

what uri should be configured in the apollo client to provide the schema?

eg.

Take a look at this example!

1 Like

perfect!

so we are using nuxt and the apollo module, and thus our config looks like:


export default function(context){                                                                                                                                   return {                                                                                            
        httpEndpoint: 'https://graphql.datocms.com/preview',
        getAuth: () => process.env.DATO_API_TOKEN                                                                                                                   }                                                                                                   
}          

we see errors querying modular content types with this style as the schema cannot guess the types. the docs suggest that configuring with the schema file, which i know dato servers on a url, as the answer. my questions are:

  • should the schema file/uri be automatically discovered by the apollo client, or do i need to configure apollo to know about the datocms generated schema uri for our backend?

  • is there another way to query intra-modular-object values where some in the list to not have the filed while others do. it is this type of query that gives apollo, but not vanilla js, fits because it can’t seem to deal with the polymorphic types / dynamic schema inside/across the modular content blocks. in plain english it struggles to understand a list of things of polymorphic types

hey @dojo4 unfortunately with Apollo you need to provide the schema yourself.

Have a look at this link for more details: https://github.com/datocms/react-apollo-demo#setting-up-apollo-client

hope that helps!

1 Like

@mat_jack1 - thanks. that was just what we were looking for!

1 Like