Symfony Finland: Adding a GraphQL API to your Symfony Flex application
On the Symfony Finland site there's a new post sharing a tutorial showing how to add a GraphQL API to your application with the help of the overblog/graphql-bundle
bundle.
I've been using GraphQL for some API thingamajigs, and it's been working fine. Now with Symfony 4 out, I figured a write-up on how to use GraphQL with Symfony Flex could be useful for someone.We'll expand on a previous demo app that I built. That app already uses Doctrine ORM as storage, so let's bridge that to a GraphQL API.
He starts by linking to "a quick read" about GraphQL for those not familiar and listing out the basic structure of the application he'll build out. Next comes the installation of the bundle and a debug bundle to help make it easier to locate errors. He then updates the application configuration to add routes and define the schema for the objects in the system. Using the GUI that comes with the debug package, he shows how to access the API and how to create a "resolver" that will relay the information back to the client from the GraphQL API request.