How to use next-apollo - 7 common examples

To help you get started, we’ve selected a few next-apollo 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 keystonejs / keystone / demo-projects / contextual-help / app / lib / apollo.js View on Github external
import { withData } from 'next-apollo';
import { HttpLink } from 'apollo-link-http';
import fetch from 'node-fetch';

// can also be a function that accepts a `context` object (SSR only) and returns a config
const config = {
  link: new HttpLink({ uri: '/admin/api', fetch }),
  onError: e => {
    console.error(e.graphQLErrors);
  },
};

export default withData(config);
github ryanbelke / strapi-next / frontend / lib / apollo.js View on Github external
import { HttpLink } from "apollo-link-http";
import { withData } from "next-apollo";

const config = {
  link: new HttpLink({
    uri: "http://localhost:1337/graphql", // Server URL (must be absolute)
    opts: {
      credentials: "same-origin" // Additional fetch() options like `credentials` or `headers`
    }
  })
};
export default withData(config);
github strapi / strapi-examples / nextjs-react-strapi-deliveroo-clone-tutorial / frontend / lib / apollo.js View on Github external
/* /lib/apollo.js */

import { HttpLink } from "apollo-link-http";
import { withData } from "next-apollo";

const config = {
  link: new HttpLink({
    uri: "http://localhost:1337/graphql", // Server URL (must be absolute)
    opts: {
      credentials: "same-origin" // Additional fetch() options like `credentials` or `headers`
    }
  })
};
export default withData(config);
github adamsoffer / next-apollo-example / lib / apollo.js View on Github external
import { withData } from "next-apollo";
import { HttpLink } from "apollo-boost";

const config = {
  link: new HttpLink({
    uri: "https://api.graph.cool/simple/v1/cixmkt2ul01q00122mksg82pn", // Server URL (must be absolute)
    opts: {
      credentials: "same-origin" // Additional fetch() options like `credentials` or `headers`
    }
  })
};

export default withData(config);
github hasura / graphql-engine / community / sample-apps / nextjs-postgres-graphql / config.js View on Github external
import { withData } from 'next-apollo'
import { HttpLink } from 'apollo-link-http'

const config = {
  link: new HttpLink({
    uri: 'http://localhost:8080/v1/graphql', // <- Configure GraphQL Server URL (must be absolute)
  })
}

export default withData(config)
github cofacts / rumors-site / lib / apollo.js View on Github external
return defaultDataIdFromObject(object);
  }
}

const config = {
  link: new BatchHttpLink({
    uri: `${PUBLIC_API_URL}/graphql`, // Server URL (must be absolute)
    headers,
    credentials: 'include', // Additional fetch() options like `credentials` or `headers`
  }),
  createCache() {
    return new InMemoryCache({ dataIdFromObject: customIdMapper });
  },
};

export default withData(config);

next-apollo

React higher-order component for using the Apollo GraphQL client inside Next.js

MIT
Latest version published 2 years ago

Package Health Score

51 / 100
Full package analysis

Popular next-apollo functions