Graphql
--
How it works:
- You have an end point (ex: https://apollo-fullstack-tutorial.herokuapp.com/graphql) you need to have a backend setup with graphql. /query is the schema of your backend. your schema contains all your API’s responses in one API.
- You make request to end point but you only request the data that you need to display.
- For example: I’m working on the user profile screen,
the user screen displays:
- UserImage
- Username
- UserId
- I only request the above data and my response is only the requested data.
Graph QL — interesting technology, seems like client asks for what data it wants from back-end. The response contains only what we need.
It’s use in Facebook.
Tutorial to get started: https://www.apollographql.com/docs/android/tutorial/03-write-your-first-query/
Notes:
My open source contribution: https://github.com/apollographql/apollo-android/pull/3027
Questions:
Each client makes own requests?
I’m new too GraphQl — -> Currently the app is server driven, and with GraphQL looks like it will change to client driven?… is that the goal?
Publich GraphQL API’s — https://github.com/APIs-guru/graphql-apis
APIs- looks like the API needs to be available trugh Graph API.
It’s not a /GET request HTTP, now GraphQL API (it’s like a wrapper) handles the request. The client’s API response only returns what the client requested (returns a clean response)