hey quick question...I'm working on my application...
# orm-help
d
hey quick question...I'm working on my application Graphql service and a lot of the queries I just want to proxy through to the prisma server. Is there an easy way to do that w/ the generated files so I don't have to recreate all of the prisma schema/queries and mutations in my applicaiton server?
c
usually when you set up apollo server
you import the prisma schema and your application schema
and then you can just return types from your prisma schema
thats how I do it
if you need to override fields or extend types, it gets a little hackier
I do that too
but if you just want to pass through its easy
d
any chance you could share a code snippet as to how this is done ?
I have something like this as of now
Copy code
t.field("updateFont", "Font", {
    args: {
      id: idArg(),
      font: stringArg({ nullable: false })
    },
    resolve: async (parent, { font, id }, context) => {
      return context.prisma.updateFont({
        where: { id },
        data: { font }
      });
    }
  });
c
I'm actually writing a series of blog post on how to do this now, but I can share a gist on the mechanics
Actually, here is a github repo im using for the demo code. It has 3 servers, 2 backend and 1 gateway, all in apollo. The gateway proxies the backend server gql and also extends it.
d
@cb im out right now but will take a look at this when i get back, just want to thank you ahead of time for sharing!
c
sorry, which thing were you asking me for a snippet for?