Hi, i have a question re the answer on this forum ...
# orm-help
d
Hi, i have a question re the answer on this forum post: https://www.prisma.io/forum/t/different-method-of-importing-content-types-into-schema-graphql/3475 is it ever acceptable to only use the generated schema from prisma when using graphgql-yoga?
Copy code
const server = new GraphQLServer({
  typeDefs: JUST USE GENERATED/PRISMA.GRAPHQL?,
  resolvers,
  mocks: process.env.MOCKS === 'true' ? mocks : null,
  context: req => ({
    req,
    prisma: new Prisma({
      typeDefs: './src/generated/prisma.graphql',
      endpoint: process.env.PRISMA_ENDPOINT,
      debug: true,
    }),
  }),
});
I can import what i want from the generated schema, but i can have nothing else in the schema file referenced from typeDefs in GraphQLServer
I think the answer is even though the concept of just using the generated schema exists, you just shouldnt do it, and expose only what you need to the client app?
c
you can basically do whatever you want. you don't even need a graphql-server and can directly query prisma server from your client app. It's all a matter of tradeoffs. Think about a few things, like: Who is using the app? Who is developing the app? What about data security? For anything that is more-or-less public (i.e. internet/intranet), has non-developer users or users that might have malicious intents, i would not certainly not recommend it.
👍 1