Câu hỏi phỏng vấn GraphQL
Câu hỏi

Explain the main difference between REST and GraphQL

Câu trả lời

The main difference between REST and GraphQL is how they handle data fetching and manipulation.

In a REST API, the client makes HTTP requests to specific endpoints that return fixed data structures. The client has no control over the shape of the response - it gets exactly what the server returns, which can lead to over-fetching (getting more data than needed) or under-fetching (needing to make multiple requests to get all the required data)[1][2].

In contrast, GraphQL uses a single endpoint and lets the client specify exactly what data it needs in the request body using a declarative query language. The client can request only the fields it requires, preventing over-fetching. GraphQL also allows fetching data from multiple sources in a single request[1][3].

Some other key differences:

  • REST uses standard HTTP methods like GET, POST, PUT, DELETE to...
middle

middle

Gợi ý câu hỏi phỏng vấn

expert

What the criteria set is for deciding when to use GraphQL vs. HATEOAS?

junior

How to do Error Handling in GraphQL?

junior

What is GraphQL schema ?

Bình luận

Chưa có bình luận nào

Chưa có bình luận nào