Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I find it really useful when your API accesses many different data sources, especially if they aren’t ones you control. You can make requests out only if you need to based on the query fields. It’s a great layer of glue for other APIs. If those other APIs are also GQL the process is very easy on your end.

GQL can abstract auth layers for external services, the user only has to auth with your service. The user only has to keep track of your single GQL url path instead of remembering “GET /users, PUT /posts, etc”. You’d probably have a premade GQL playground setup at the single URL too. If you forget the query options, do an introspection query, which most interactive GQL clients do in the background for you. It also makes caching/memos really easy, as you can memoize the GQL layer based on user query instead of implementing it for each upstream resource. Same deal with rate limiting. Also being able to ask for arbitrary number of resources by just making more named queries in a single request can be useful.

Having the .gql file be THE source of truth and typing for your schema is really nice. Most other setups I've seen like OpenAPI are usually disconnected from your actual API code, where it’s technically possible to diverge from your stated schema.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: