Using GraphQL Fetcher to query local site

Hi all,

It might be a very silly question but does GraphQL Fetcher supports own query to site’s GraphQL.

What should be the URL parameter if that is possible then?

Thank you!!

Hi, apologies, I’m having trouble understanding the question. Would you mind elaborating some more on what you mean? Or perhaps showing an example with screenshots?

Hi Yang,

Thank you for taking another question of mine :blush:

For example, with Gatsby, when running development build locally, I can access the GraphiQL on http://localhost:8000/___graphql to query and obtain data such as siteMetadata and then convert it into GraphQL query such as:

export const query = graphql`
  query {
    site {
      siteMetadata {
        title
        siteUrl
        description
      }
    }
  }
`

The screenshot of GraphiQL that I mentioned.

When I am trying to explore Plasmic’s GraphQL Fetcher component, it has a very similar interface with GraphiQL and I thought of using it instead of adding my own code component. The only question is what should be the URL I should put into the props of GraphQL Fetcher to make it work.

image

Hi, unfortunately, the graphql queries that are supported in Gatsby are not true network graphql requests. They are just a way that Gatsby propagates data throughout its own infrastructure locally.

The graphql that you’re in plasmic is intended to let you query actual graphql apis. So the URL that you plug in depends on whether you are querying shopify, contentful, github, or any other service.

Let me know if that makes sense

1 Like

Thank Yang, that makes sense.