Hi everyone, I've been following graphql lately and i don't yet fully understand the difference between prisma, graphql and apollo grapghql, ive gone through their docs but the whole concept seems overwhelming i would want the community to explain how they differ from each other and what they tend to fix, Thanks
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (4)
Prisma
Prisma is a database ORM. This means that in your schema.prisma you can define tables and regardless of if you are using mysql, postgresql or others prisma will handle the data.
Prisma will generate a photon api file which is what will let you query the database. For instance you would have:
Prisma example: github.com/prisma/photonjs#api-exa...
GraphQL
GraphQL is a query language for your API, and a server-side runtime for executing queries by using a type system you define for your data.
Think of it as your express node app but instead of having to define many endpoints: /user, /posts, /subscriptions
You have only one endpoint where you structure queries almost like javascript objects:
When calling the API you can specify which fields you want so in database you would have: user: {name, age, gender, password}
and you could also query:
Queries example: graphql.org/learn/queries/
Apollo
Apollo has many tools and parts in it so it would depend the one you use. For my project I have used: React Apollo: apollographql.com/docs/react/api/r...
Which generates code and wraps objects, queries to the graphql endpoint.
for instance you can define one query:
And you can then use a function as follows:
In here Apollo will directly talk with the GraphQL endpoint and execute the necessary query and handle response and loading states. Apollo also implements query caching, and more.
Source: apollographql.com/docs/react/data/...
Thanks a lot, it really helped 🤗
🤔🤔 only if people will write their docs in this manner
🥰🥰