Apollo Example For Graphql In Action
Apollo Client Example
Changelog
-
Nothing here yet…
Listings
import 'regenerator-runtime/runtime'; import * as config from './config'; import { ApolloClient, HttpLink, InMemoryCache, gql, } from '@apollo/client'; const apolloHttpLink = new HttpLink({ uri: config.GRAPHQL_SERVER_URL }); const client = new ApolloClient({ link: apolloHttpLink, cache: new InMemoryCache(), }); async function main() { const { data, errors } = await client.query({ query: gql` query { numbersInRange(begin: 1, end: 100) { sum } } `, }); console.log({ data, errors }); } main();