[SOLVED] Should GraphQL be used in backend or frontend?


This Content is from Stack Overflow. Question asked by Kaan Yılmaz

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?


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

This Question was asked in StackOverflow by Kaan Yılmaz and Answered by Markus It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?