yarn add @graphql-ez/plugin-voyager
pnpm add @graphql-ez/plugin-voyager
npm install @graphql-ez/plugin-voyager
Integration with GraphQL Voyager
import { ezVoyager } from '@graphql-ez/plugin-voyager';
const ezApp = CreateApp({
ez: {
plugins: [
ezVoyager({
// Options
}),
// ...
],
},
// ...
});
Most of these types come from GraphQL Voyager properties
type VoyagerPluginOptions =
| {
/**
* @default "/voyager"
*/
path?: string;
/**
* Manually transform the rendered HTML
*/
transformHtml?: (html: string) => string;
endpoint?: string;
headers?: string | Record<string, unknown>;
displayOptions?: {
rootType?: string;
skipRelay?: boolean;
skipDeprecated?: boolean;
showLeafFields?: boolean;
sortByAlphabet?: boolean;
hideRoot?: boolean;
};
credentials?: 'same-origin' | 'include' | 'omit';
}
| boolean;
In Next.js you need to use this plugin's handler explicitly in your API routes,
for example, following the file structure: /pages/api/voyager.ts
, and using this snippet:
// /pages/api/voyager.ts
import { VoyagerHandler } from '@graphql-ez/plugin-voyager';
export default VoyagerHandler({
endpointUrl: '/api/graphql',
});
For Vercel you need to use this plugin's handler explicitly in your API routes,
for example, following the file structure: /api/voyager.ts
, and using this snippet:
// /api/voyager.ts
import { VoyagerHandler } from '@graphql-ez/plugin-voyager';
export default VoyagerHandler({
endpointUrl: '/api/graphql',
});
@graphql-ez/plugin-voyager
MIT
0.10.0
Dec 18th, 2022