Add Apollo Client and GraphQL dependencies, and
create Apollo Client instance.
This commit is contained in:
16
src/utils/graphql.ts
Normal file
16
src/utils/graphql.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import { ApolloClient, createHttpLink, InMemoryCache } from '@apollo/client/core'
|
||||
|
||||
// HTTP connection to the API
|
||||
const httpLink = createHttpLink({
|
||||
// You should use an absolute URL here
|
||||
uri: 'http://localhost:3020/graphql',
|
||||
})
|
||||
|
||||
// Cache implementation
|
||||
const cache = new InMemoryCache()
|
||||
|
||||
// Create the apollo client
|
||||
export const apolloClient = new ApolloClient({
|
||||
link: httpLink,
|
||||
cache,
|
||||
})
|
Reference in New Issue
Block a user