Angular CLI

Installation

To get started with Apollo and Angular install few needed packages. Take a look at Installation section.

Initialization

Take a look at Initialization section.

Proxy

If your GraphQL endpoint lives under different host with Angular CLI you can easily define proxy configuration.

Take for example api.example.com/graphql:

1
2
3
4
5
{
"/graphql": {
"target": "http://api.example.com"
}
}

Create a json file (proxy.config.json for example) with that configuration.

To run server use --proxy-config option:

1
ng serve --proxy-config <path to file>

An example:

1
ng serve --proxy-config proxy.config.json
Edit on GitHub