@graphql-ez/plugin-voyager
v0.10.1
Published
Integration with [GraphQL Voyager](https://apis.guru/graphql-voyager/)
Downloads
149
Readme
@graphql-ez/plugin-voyager
Integration with GraphQL Voyager
Usage
import { ezVoyager } from '@graphql-ez/plugin-voyager';
const ezApp = CreateApp({
ez: {
plugins: [
ezVoyager({
// Options
}),
// ...
],
},
// ...
});
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;
Next.js Usage
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',
});
Vercel Usage
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',
});