Raw GraphQL Querying #Dev

2 months ago
Raw GraphQL Querying

GraphQL has all kinds of awesome tooling built around it. But like everything on the web, it ultimately comes down to data shootin’ across the ol’ network and responses coming back. If you need to talk to a GraphQL API endpoint, you don’t absolutely have to use some kind of framework or library to make requests against it. As a matter of fact, you can do it pretty cleanly in vanilla JavaScript. Take the Pokémon API, available in GraphQL, which I found via this list of APIs. It has a GraphiQL interface for exploring. From that page, you can execute queries and see the results. You can also poke into the Network tab in DevTools and see the payload for requests it sends off, and see that it’s just a bit of JSON that is POSTed. We can make our own JSON in that format too! First, we’ll make it…

Leave a Reply