Presentation layer

In  Chapter 2, A Three-Tier Web Application using REST, our React application was making API calls to our REST endpoints. This REST API that we built returns JSON, which our frontend code easily digests and feeds into our React code for rendering UI elements.

With a change to a GraphQL-based API, our frontend code will need to change somewhat drastically for the data-fetching sections. GraphQL behaves very differently than REST, and there is no corollary between a REST endpoint, which returns a known set of data, and GraphQL. Each GraphQL query is unique in that the client is responsible for asking for a specific set of data.

We won't review the changes to the frontend code. At the time of writing, popular choices for GraphQL ...

Get Serverless Design Patterns and Best Practices now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.