Summary
In this chapter, we connected our previously created GraphQL backend to the frontend using Apollo Client. We started by setting up Apollo Client and making a GraphQL query to fetch all posts. Then, we improved the performance of the post list by fetching author usernames in a single request, leveraging the power of GraphQL.
Next, we introduced variables in our query and re-implemented sorting and filtering by author. We also introduced fragments in our queries to reuse the same fields. Lastly, we implemented GraphQL mutations in the frontend to sign up, log in, and create posts. We also learned about re-fetching queries in Apollo Client along the way and briefly mentioned advanced concepts of GraphQL and Apollo.
In the next chapter, Chapter 13, Building a Backend Based on Event-Driven Architecture Using Express and Socket.IO, we are going to depart from traditional full-stack architectures and build a new app using a special kind of full-stack architecture: an event-based...