Chapter 15. Working with data using GraphQL
This chapter covers
- Requesting data from the server with GraphQL and Axios
- Supplying data to a Redux store
- Implementing a GraphQL back end with Node/Express
- Supporting hash-less URL routing
In chapter 14, you implemented a Netflix clone with Redux. The data came from a JSON file, but you could instead have used a RESTful API call using axios or fetch(). This chapter covers one of the most popular options for providing data to a front-end app: GraphQL.
Thus far, you’ve been importing a JSON file as your back-end data store or making RESTful calls to fetch the same file to emulate a GET RESTful endpoint. Ah, mocking APIs. This approach is good for prototyping, because you have the front end ready; when you need persistent storage, you can replace mocks with a back-end server, which is typically a REST API (or, if you really have to, SOAP[1]).
1SOAP is a mostly outdated protocol that relied heavily on XML and has now been replaced by REST.