Introducing and installing Apollo Client
In this section, we'll introduce you to Apollo Client, which helps you integrate your Angular frontend with your GraphQL API built on top of Apollo Server. Then, we'll see how to install and configure Apollo Client in our Angular project.
Apollo Client is a JavaScript state management library that allows developers to manage local and remote data using GraphQL. It can be used to retrieve, cache, and update application data while also automatically synchronizing data changes with your UI.
Let's install Apollo Client in our Angular project:
- Return to your Terminal and execute the following command from your Angular project's root folder:
ng add apollo-angular
The apollo-angular
package will be installed and executed. You will be asked the following question:
Would you like to proceed?
Type Y and press Enter.
- Following that, you'll be prompted to enter the URL to your GraphQL endpoint....