How to use the apollo-client.default function in apollo-client

To help you get started, we’ve selected a few apollo-client 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 vovaguguiev / react-apollo-ssr-example / src / server.js View on Github external
});

// define ApolloClient's NetworkInterface, that will resolve the queries locally
const localGraphQLNetworkInterface = {
  query: (graphqlRequest) => graphql(
      graphqlSchema,
      print(graphqlRequest.query),
      null,
      null,
      graphqlRequest.variables,
      graphqlRequest.operationName
  )
};

// initialize ApolloClient
const apolloClient = new ApolloClient({
  networkInterface: localGraphQLNetworkInterface
});

app.use('/graphql', expressGraphql({
  schema: graphqlSchema,
  graphiql: true
}));

// Server-Side-Rendering
app.use((req, res) => {

  const history = createMemoryHistory(req.path);
  const routes = getRoutes();

  // Find the correct route
  match({ history, routes, location: req.url }, (err, redirectLocation, renderProps) => {
github sonnylazuardi / reactriot2017-dotamania / index.js View on Github external
var express = require('express');
var app = express();
var bodyParser = require('body-parser');
var axios = require('axios');
var swig  = require('swig');
var gql = require('graphql-tag');
var ApolloClient = require('apollo-client').default;
var createNetworkInterface = require('apollo-client').createNetworkInterface;
var networkInterface = createNetworkInterface({ uri: 'https://api.graph.cool/simple/v1/cj4i1ifeamv640130f4nkogb0' });
var client = new ApolloClient({ networkInterface: networkInterface });
require('es6-promise').polyfill();
require('isomorphic-fetch');

app.set('port', (process.env.PORT || 5000))

app.engine('html', swig.renderFile);
app.set('view engine', 'html');
app.set('views', __dirname + '/build');

app.use(bodyParser.json());

app.get(['/', '/scrape/:key'], function(req, res) {
  const key = req.params.key;
  console.log('KEY', key);

  let initialData = {
github xing / hops / packages / react-apollo / mixin.server.js View on Github external
createClient(options) {
    return new ApolloClient(this.enhanceClientOptions(options));
  }
github xing / hops / packages / graphql / lib / common.js View on Github external
createClient: function(options) {
    return new ApolloClient(this.enhanceClientOptions(options));
  },
  enhanceClientOptions: function(options) {
github xing / hops / packages / react-apollo / mixin.browser.js View on Github external
createClient(options) {
    return new ApolloClient(this.enhanceClientOptions(options));
  }
github revskill10 / next-template / modules / core / api / create-link.js View on Github external
function getApolloClient({link}) {
  return new ApolloClient({
    link,
    cache: new InMemoryCache(),
  })
}
github xing / hops / packages / graphql / mixin.browser.js View on Github external
createClient(options) {
    return new ApolloClient(this.enhanceClientOptions(options));
  }
github xing / hops / packages / graphql / mixin.server.js View on Github external
createClient(options) {
    return new ApolloClient(this.enhanceClientOptions(options));
  }