GraphQL is an alternative to REST, created by Facebook (http://graphql.org/). This technology allows a server to implement and publish a schema, and the clients then can ask for the information they need, rather than understanding and making use of various API endpoints.
For this recipe, we'll create a Graphql schema that represents a deck of playing cards. We'll expose one resource card, which can be filtered by suit and value. Alternatively, this schema can return all the cards in the deck if no arguments are specified.
How to do it...
These steps cover writing and running your application:
- From your Terminal or console application,createa new directory called~/projects/go-programming-cookbook/chapter12/graphqland navigate to this directory.
- Run this command:
$ go mod init github.com/PacktPublishing/Go-Programming-Cookbook-Second-Edition/chapter12/graphql
...