Use demo resolvers in local deployment?



When deploying to the Demo server I get tons of nice API endpoints and options out if the box like sorting, skipping records, etc. just from providing a GraphQL schema. When I switch to a local deployment, it’s like I start from scratch and I have to implement these resolvers manually which takes a while.

Is there a way to get the best of both worlds and deploy locally, but with all of those sorting, skipping, etc. resolvers auto-generated for me? I would like to add authentication and permissions on top, but it would save a lot of time if the resolvers were auto-generated and then I could edit them rather than having to create them all by hand.


Check this out, might be of some help.

You can just import the generated schema or even better, copy everything and remove all references to Node interface.

Permissions? Check out GraphQL Shield,

Hope this helps you! :slightly_smiling_face:


Why do you suggest to remove the Node interface?


If you decide to import the generated schema from Prisma, it still includes Node interface. When graphql-tools try to generate the GraphQLSchema instance the type resolver is missing because it cannot be auto-generated which causes the error.


Ah I see - that’s not an error but a warning, and you can either implement a Node type resolver or disable the warning using a server setting. See more information here: :slight_smile:


Thanks. Is there a CLI command to generate the resolvers? Or do I have to deploy to Prisma servers and then somehow copy the code from there?


@everdev you only need schema. Resolvers are automatically generated by graphql-tools and graphql-middleware-forward-binding.

Check out the example in README. :slightly_smiling_face:


Thanks! works like a charm :slight_smile: