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 { gql } from "apollo-boost";
    // or you can use `import gql from 'graphql-tag';` instead
    
    ...
    
    client
      .query({
        query: gql`
          {
            rates(currency: "USD") {
              currency
            }
          }
        `
      })
      .then(result => console.log(result));
    Docs
  • import ApolloClient from "apollo-boost";
    
    const client = new ApolloClient({
      uri: "https://w5xlvm3vzz.lp.gql.zone/graphql"
    });
    Docs
  • import { Accounts } from 'meteor/accounts-base'
    import ApolloClient from 'apollo-boost'
    
    const client = new ApolloClient({
      uri: '/graphql',
      request: operation =>
        operation.setContext(() => ({
          headers: {
            authorization: Accounts._storedLoginToken()
          }
        }))
    })
    Docs
  • import ApolloClient from 'apollo-boost'
    
    const client = new ApolloClient({
      request: (operation) => {
        const token = localStorage.getItem('token')
        operation.setContext({
          headers: {
            authorization: token ? `Bearer ${token}` : ''
          }
        })
      }
    })
    Docs
  • const { ApolloServer, gql } = require('apollo-server');
    
    // Hardcoded data store
    const books = [
      {
        title: 'The Awakening',
        author: 'Kate Chopin',
      },
      {
        title: 'City of Glass',
        author: 'Paul Auster',
      },
    ];
    
    // Schema definition
    const typeDefs = gql`
      type Book {
        title: String
        author: String
      }
    
      type Query {
        books: [Book]
      }
    `;
    
    // Resolver map
    const resolvers = {
      Query: {
        books() {
          return books;
        }
      },
    };
    
    // Pass schema definition and resolvers to the
    // ApolloServer constructor
    const server = new ApolloServer({ typeDefs, resolvers });
    
    // Launch the server
    server.listen().then(({ url }) => {
      console.log(`🚀  Server ready at ${url}`);
    });
    Docs
  • Powered by Official black Bloop logo with a period
    download the IDE extension

    View other examples