graphql-engine/community/sample-apps/nextjs-postgres-graphql/config.js
hasura-bot 95444b60da update the nextjs postgres graphql sample app
GITHUB_PR_NUMBER: 9048
GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/9048

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6159
Co-authored-by: Amit Kumar Sharma <91947037+amit-ksh@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
GitOrigin-RevId: 0565d8a00c944d72b46bc5ce0ff40fc3e8bfca51
2023-02-01 12:28:44 +00:00

28 lines
802 B
JavaScript

import withApollo from "next-with-apollo";
import { ApolloClient, ApolloProvider, InMemoryCache } from "@apollo/client";
// Learn more about `@apollo/client` here - https://www.apollographql.com/docs/react/why-apollo
// Learn more about `next-with-apollo` here - https://github.com/lfades/next-with-apollo
// creating the Apollo Client
const client = new ApolloClient({
uri: process.env.NEXT_PUBLIC_HASURA_APP_URL, // <- Configure GraphQL Server URL (must be absolute)
cache: new InMemoryCache()
});
export default withApollo(
() => {
return client;
},
{
// providing the Apollo Client access to the pages
render: ({ Page, props }) => {
return (
<ApolloProvider client={props.apollo}>
<Page {...props} />
</ApolloProvider>
);
}
}
);