Should GraphQL be used in backend or frontend?

Viewed 36

Does using GraphQL directly on React cause security threats such as server information and browser manipulation? Is this road safe?

Or should we call the GraphQL data from the backend? But if this happens, we will be using the Restful API again to use GraphQL this time.

In what situations and where should GraphQL be used?

1 Answers

First of all, graphQL is a communication protocol. That means you can transfer data between a client and a server. The client can send an HTTP request (mostly the foundation of graphQL) with a query and optional variables to a server. The server resolves and processes the query and answers with some data.

To answer your question: If you use graphQL, you can use it for both the client and server side. Make sure that you build authentication/authorization logic for sensitive data.

For more information checkout this blog post: https://blog.postman.com/what-is-a-graphql-api-how-does-it-work

Related