1

I'm running prisma side by side with my graphql application API. I can run prisma generate which produces the client side code and everything is great. However a majority of my endpoints on my application API are nothing more than a proxy to the prisma service. For example, I have a basic Font data model that the user should be able to perform CRUD operations on.

As of now I'm manually creating those CRUD queries with hard coded argument. Is there a way I can simply import code from the prisma client to automagically create those CRUD operations?

3
  • How are you using sdl? Commented Feb 5, 2019 at 19:42
  • @genpfault I'm using github.com/prisma/nexus-prisma Commented Feb 5, 2019 at 19:43
  • I don't think we have such tooling now Commented Feb 6, 2019 at 0:52

2 Answers 2

1

You cannot do that with prisma-client. It is expected that you will have your own services on top of Prisma layer that includes your simplified REST endpoints or application level GraphQL server, Authorization, etc.

However, if most of the time you are going to do this, then consider using prisma-bindings instead of prisma-client. It has a forwardTo API but it is only gql to gql forwarding.

Note: For express.js, there is a mapping middleware, rest-graphql but has very limited use.

Sign up to request clarification or add additional context in comments.

Comments

0

I'm not sure if I fully understand but if you are trying to create CRUD methods on all your datatypes a service like GraphCool might work better than Prisma?

It's older and less customisable than Prisma but does come with Queries and Mutations setup for all your data types.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.