0

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!

1 Answer 1

2

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  +          +
+-------------+           +------------------+       +----------+
Sign up to request clarification or add additional context in comments.

3 Comments

Does it mean that my REST service makes requests to the graphql server, and the graphql server queries the database with SQL?
Thanks a lot, that makes it clearer to me! Do you have an advice for a tutorial which is like my scenario?
I cannot, because I don't know what your environment is, or what languages you are familiar with. I used graphql-jpa, which I would not recommend unless you already know Spring Boot.

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.