Search
Duplicate

GraphQL

Traditional REST APIs work with the concept of Resources that the server manages. We can manipulate these resources in some standard ways, following the various HTTP verbs. This works very well as long as our API fits the resource concept but quickly falls apart when we need to deviate from it.
This also suffers when the client needs data from multiple resources simultaneously, such as requesting a blog post and comments. Typically, this is solved by having the client make multiple requests or having the server supply extra data that might not always be required, leading to larger response sizes.
GraphQL offers a solution to both of these problems. It allows the client to specify exactly what data it desires, including navigating child resources in a single request and allows for multiple queries in a single request.
The β€œ!” at the end of some names indicates that it's a non-nullable type. Any type that doesn't have this can be null in the response from the server. The GraphQL service handles these correctly, allowing us to safely request child fields of nullable types.
The GraphQL Service also exposes the schema using a standard set of fields, allowing any client to query for the schema definition ahead of time.
This allows the client to automatically detect when the schema changes and allows clients to adapt dynamically to how the schema works. One incredibly useful example is the GraphiQL tool, which allows us to interact with any GraphQL API.
input 객체에 λ§€ν•‘ν•˜λ €λ©΄ setter κ°€ ν•„μš”ν•˜λ‹€
scalar
ID
interface
union
hashtag findBy id name
hashtag update
category find