Neapolitan Pizza Margherita

    @graphql-ez/plugin-voyager
    TypeScript icon, indicating that this package has built-in type declarations

    0.10.0 • Public • Published

    @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',
    });

    Keywords

    none

    Install

    npm i @graphql-ez/plugin-voyager

    DownloadsWeekly Downloads

    549

    Version

    0.10.0

    License

    MIT

    Unpacked Size

    21.1 kB

    Total Files

    9

    Last publish

    Collaborators

    • pablosz