NextJS
Getting started guide for using Pokko with NextJS websites
Getting started
yarn add @apollo/client graphql
# or, if you are using npm
npm install --save @apollo/client graphqlimport {
ApolloClient,
ApolloClientOptions,
InMemoryCache,
NormalizedCacheObject,
} from "@apollo/client";
const config = {
environment: process.env.POK_ENVIRONMENT!,
project: process.env.POK_PROJECT!,
token: process.env.POK_TOKEN!,
};
const options = (
token: string
): ApolloClientOptions<NormalizedCacheObject> => ({
cache: new InMemoryCache(),
headers: {
"X-Token": token,
},
uri: `https://au-syd1.pokko.io/${config.project}/${config.environment}/graphql`,
});
export const client = new ApolloClient(options(config.token));Code generation
Last updated