
General Description of the Book
The book is relatively short, consisting of just 7 chapters. It includes some images, though not many. It is quite easy to read and goes quickly.
Brief Overview of the Chapters
The first two chapters are purely theoretical. They describe what GraphQL is, when and by whom it was invented, and where it can be used. They also discuss its advantages and disadvantages compared to REST, its syntax, principles, and more along these lines. One entire chapter from these two is dedicated to graph theory. It covers vertices, nodes, the history of graph theory, the Königsberg bridges, Eulerian cycles, examples of graphs in programming (such as the simplest DOM tree in a browser), and similar information.
Around page 50 (out of a total of 240), the book delves deeper into GraphQL. Initially, it compares GraphQL to SQL. Then, it reviews tools and online platforms where you can practice with GraphQL. The syntax and main types of queries are discussed in detail, as well as fragments as a way to reuse parts of code.
The next chapter is about the GraphQL Schema. Here, data types, their definition, and usage are described in detail. Additionally, validation is covered, as well as relationships (one-to-one, one-to-many, many-to-many). Interfaces and arguments are also explained in some depth, along with filtering and pagination.
The chapter on the GraphQL API focuses on a practical example of working with photos using GraphQL and JavaScript. It describes the entire process—from installing apollo-server and apollo-server-express to connecting MongoDB. The setup and basic configurations of all the installed software are covered in detail.
While the previous chapter focused on building the server, this one shifts to the client (within the same example of uploading images). Apollo Client is chosen as the client implementation. To make the task more complex, the author demonstrates how to integrate GraphQL with React, and for a more realistic example, authentication and caching are used.
The final chapter wraps up the previously started project and introduces even more advanced concepts—such as subscriptions and real-time file uploads. Attention is also given to security issues: problems related to the depth and complexity of queries are highlighted.
Opinion
GraphQL is a good alternative to the popular REST approach. This book introduces the new data transfer standard using the GraphQL query language as an example. It provides some introductory information on why it is needed, what problems it solves, and a bit about graph theory—before diving into the details and syntax of GraphQL. My introduction to GraphQL began with this book, and I didn’t encounter any difficulties while reading it. The book seemed quite understandable and straightforward, so I can recommend it to others.