How to use gatsby-source-graphql - 1 common examples

To help you get started, we’ve selected a few gatsby-source-graphql examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github graphile / gatsby-source-pg / gatsby-node.js View on Github external
utils,
  {
    typeName = "PostGraphile",
    fieldName = "postgres",
    refetchInterval,
    ...options
  }
) => {
  const { connectionString, schema: postgresSchema, ...rest } = options;

  const pool = new Pool({
    connectionString,
  });
  const graphqlSchema = await createSchema(pool, postgresSchema, rest);

  await gatsbySourceGraphQLNode.sourceNodes(utils, {
    typeName,
    fieldName,
    refetchInterval,
    createLink: () => new PostGraphileLink({ pool, schema: graphqlSchema }),
    createSchema: () => graphqlSchema,
  });
};

gatsby-source-graphql

Gatsby plugin which adds a third-party GraphQL API to Gatsby GraphQL

MIT
Latest version published 4 months ago

Package Health Score

92 / 100
Full package analysis

Popular gatsby-source-graphql functions