I recently needed to create a GraphQL schema quickly and decided to create this quick guide to help me next time I needed to do something similar
GraphQL
GraphQL provides an entirely different paradigm from REST APIs. Rather than needing to write a different endpoint / controller to return different data, GraphQL provides clients the opportunity to specify the data they want. GraphQL then returns the specificly request datasets.
Schema
Here is a sample GraphQL schema containing and organisation and a user
Sample Data
Sample data is created using in JSON format
Root Value
The following value accessors are required to retrieve data from the server
Starting up the server
Here is how the GraphQL server is setup with a node.js express app.
Comments
Post a Comment