Reputation: 103
I have an existing Node.js REST API that currently uses pg-promise for querying data from database. But instead I want to use GraphQL for querying the data from database. So, I want to use GraphQL only internally. All tutorials I found show how to build a GraphQL server. But can I use GraphQL only internally for querying data as well?
Thanks!
Upvotes: 0
Views: 283
Reputation: 255
Yes, but you'll still need to set up a graphql server.
Databases speak SQL and won't understand graphql directly. You need a separate application to receive the graphql and query the database.
+-------------+ +------------------+ +----------+
+ Application +-----------+ Application +-------+ database +
+ + graphql + (graphql server) + SQL + +
+-------------+ +------------------+ +----------+
Upvotes: 2