I’m using Next.js with Prisma. I’m not clear on w...
# orm-help
r
I’m using Next.js with Prisma. I’m not clear on where to define custom resolvers. Can someone point me in the direction of documentation for this.
h
You need graphql server for example
graphql-yoga
l
Hi Russ! I'm not sure there's a "best practice" on this. I use an "entity" pattern where each node is defined under the "entity" folder, e.g. "entity->user". Then each node has a schema and resolvers, e.g. user.graphql and user_resolver.js. I import the schema with
graphql-import
and import resolvers with the
merge-graphql-schemas
package. I've been thinking about writing a post on it
👍 1
Or maybe I completely answered the wrong question and @huv1k got it 🤣
r
Thanks for the advice. I just moved over to prisma after using graphcool for a while. I’m using the lib/initApollo and lib/withData approach found on github that also works with Nuxt.js. I’m not super clear on what is going on in those files though.
h
You need to write your resolvers or you can delegate them to prisma trough graphql-server, but better is to handle it with graphql-server so you can define your own schema and hide you bussines logic for example. You can look here https://github.com/graphcool/prisma/tree/master/examples/resolver-forwarding and see resolver forwarding
👍 1