React Native & Apollo Quickstart

For this quickstart tutorial, we have prepared a repository that contains the full React code for the Instagram clone. All you need to do is create the Graphcool service that will expose the GraphQL API and connect it with the React application. Let's get started!

src: Contains the source code (and if necessary GraphQL queries) for the functions you've configured for your service. Notice that a new service comes with a default "Hello World"-function (called hello in graphcool.yml) which you can delete if you don't want to use it.

The changes you introduced by adding the Post type to the data model are purely local so far. So the next step is to actually deploy the service!

5

Navigate to the server directory and deploy your service:

cd server
graphcool deploy

When prompted which cluster you want to deploy to, choose any of the Shared Clusters options (shared-eu-west-1, shared-ap-northeast-1 or shared-us-west-2).

Note: If you haven't authenticated with the Graphcool CLI before, this command is going to open up a browser window and ask you to login. Your authentication token will be stored in the global ~/.graphcoolrc.

You service is now deployed and available via the HTTP endpoints that were printed in the output of the command! The Post type is added to your data model and the corresponding CRUD operations are generated and exposed by the GraphQL API.

Notice that this command also created the local.graphcoolrc inside the current directory. It's used to manage your deployment targets.

6

Save the HTTP endpoint for the Simple API from the output of the graphcool deploy command, you'll need it later!

Note: If you ever lose the endpoint for your GraphQL API, you can simply get access to it again by using the graphcool info command. When using Apollo, you need to use the endpoint for the Simple API.

You can test the API inside a GraphQL Playground which you can open with the graphcool playground command. Feel free to try out the following query and mutation.