5 ms·
You don't have to use anything other than `fetch` to consume a graphql API.
by ericcoleman 8y ago
You don't have to use anything other than `fetch` to consume a graphql API.
- pandeiro 8y agoRight, then you basically lose caching, since the everything's-a-POST requests would go to the wire every time. Not that I haven't considered making that trade-off.
- invisible 8y agoYou can use GET if you want (since GraphQL is still just over HTTP). The implementation can largely be up to you (like REST) if you want, but you get loads of things already if you opt into some opinions that libraries have established (e.g. Apollo). See https://graphql.org/learn/serving-over-http/ https://graphql.org/learn/serving-over-http/
- yencabulator 8y agoYou can make your queries ride over GET very easily, using just fetch.
- nailer 8y agoYou shouldn't be using fetch directly accoriding to it's creator anyway - use a high level HTTP client which handles MIME types, query string encoding, etc.