Hello I have build and deploy my first qraphql wit...
# orm-help
m
Hello I have build and deploy my first qraphql with prisma service based on node advanced boilerplate every thing works fine but I cannot see the prisma auto generated queries, mutation & subsccription in prisma playground thanks it seems like playground not give the database app switcher
r
How are you accessing the playground?
m
i deployed it by now
r
If you spin up a
graphql playground
locally you can access your server and the Prisma instance.
graphql
reads your
.graphqlconfig.yml
to see what projects you have. I'd wait for someone with more expertise than me to answer this, because I'm not sure if you can and would want to have the Prisma instance accessible on your public endpoint.
m
yes you are right thanks
but how I will use prisma from front end or I should not
r
You can, but you need to consider whether you want to. Consuming the Prisma API directly from your frontend or mobile applications would be similar to directly accessing a database. This excerpt from the Node.js tutorial on howtographql.com is helpful 🙂
Why not just use the Prisma GraphQL API directly?
Prisma really only is an interface to a database. If you consumed the Prisma API directly from your frontend or mobile applications, this would be similar as directly accessing a database.
In very, very rare cases, this might be an option - but the vast majority of applications do need additional logic that is not covered by CRUD operations (data validation and transformation, authentication, permissions, integration of 3rd-party services or any other sort of custom functionality…).
Another potential concern of directly exposing the Prisma API to your client applications is security. GraphQL works in the way that everyone who has access to the endpoint of a GraphQL API can retrieve the entire GraphQL schema from it - this is called introspection. If your clients were talking directly to Prisma, it would be simply a matter of checking the network requests to get access to the endpoint of the Prisma API and everyone would be able to see your entire database schema.
m
@Robert many thanks
r
You're welcome 😄 Also helps me learn myself. You can take a look at Resolver Forwarding if your frontend queries are the same as your prisma queries: https://github.com/prismagraphql/prisma/tree/master/examples/resolver-forwarding
m
👍😄 thanks