简体   繁体   中英

Using GraphQL inside REST API for data querying

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!

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  +          +
+-------------+           +------------------+       +----------+

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM