Skip to content

Make GraphQL Modules work without useGraphQLModules() plugin #2107

Answered by n1ru4l
kensukesaito asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @kensukesaito, you can use the following recipe for serving a public/private schema with graphql-modules and @n1ru4l/graphql-public-schema-filter.

https://codesandbox.io/s/bold-napier-iqcjgp?file=/src/main.ts

import { createYoga, Plugin } from "graphql-yoga";
import { createModule, gql, createApplication } from "graphql-modules";
import { useGraphQLModules } from "@envelop/graphql-modules";
import {
  buildPublicSchema,
  publicDirectiveSDL
} from "@n1ru4l/graphql-public-schema-filter";
import { parse } from "graphql";

const myModule = createModule({
  id: "my-module",
  dirname: __dirname,
  typeDefs: [
    gql`
      type Query {
        private: String!
        public: String! @pu…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@kensukesaito
Comment options

Answer selected by n1ru4l
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #2106 on November 15, 2022 11:23.