How to use where clause in Knex
Create refunds with Stripe
Load HTML with Cheerio
How to send POST request with Axios
Find intersection of array in Lodash
Powered by Official white Bloop logo with a period

Terms / Privacy / Search / Support

  • import { createPersistedQueryLink } from "apollo-link-persisted-queries";
    import { createHttpLink } from "apollo-link-http";
    import { InMemoryCache } from "apollo-cache-inmemory";
    import ApolloClient from "apollo-client";
     
     
    // use this with Apollo Client
    // use this with Apollo Client
    const link = createPersistedQueryLink().concat(createHttpLink({ uri: "/graphql" }));
    const client = new ApolloClient({
      cache: new InMemoryCache(),
      link: link,
    });
    Docs
  • import { ApolloLink } from "apollo-link";
    import { createHttpLink } from "apollo-link-http";
     
    const httpLink = createHttpLink({ uri: "/graphql" });
    const middlewareLink = new ApolloLink((operation, forward) => {
      operation.setContext({
        headers: {
          authorization: localStorage.getItem("token") || null
        }
      });
      return forward(operation);
    });
     
    // use with apollo-client
    // use with apollo-client
    const link = middlewareLink.concat(httpLink);
    Docs
  • import { ApolloLink } from "apollo-link";
    import { createHttpLink } from "apollo-link-http";
     
    const httpLink = createHttpLink({ uri: "/graphql" });
    const addDatesLink = new ApolloLink((operation, forward) => {
      return forward(operation).map(response => {
        if (response.data.user.lastLoginDate) {
          response.data.user.lastLoginDate = new Date(
            response.data.user.lastLoginDate
          );
        }
        return response;
      });
    });
     
    // use with apollo-client
    // use with apollo-client
    const link = addDatesLink.concat(httpLink);
    Docs
  • import { HttpLink, InMemoryCache, ApolloClient } from "@apollo/client";
    import { createPersistedQueryLink } from "@apollo/client/link/persisted-queries";
    import { sha256 } from 'crypto-hash';
    
    const httpLink = new HttpLink({ uri: "/graphql" });
    const persistedQueriesLink = createPersistedQueryLink({ sha256 });
    const client = new ApolloClient({
      cache: new InMemoryCache(),
      link: persistedQueriesLink.concat(httpLink),
    });
    Docs
  • import { HttpLink, InMemoryCache, ApolloClient } from "@apollo/client";
    import { createPersistedQueryLink } from "@apollo/client/link/persisted-queries";
    import { sha256 } from 'crypto-hash';
    
    const httpLink = new HttpLink({ uri: "/graphql" });
    const persistedQueriesLink = createPersistedQueryLink({ sha256 });
    const client = new ApolloClient({
      cache: new InMemoryCache(),
      link: persistedQueriesLink.concat(httpLink);
    });
    Docs
  • Powered by Official black Bloop logo with a period
    download the IDE extension

    View other examples