All Projects → react-native-training → apollo-subscriptions-book-club

react-native-training / apollo-subscriptions-book-club

Licence: other
Book Aggregation App using Apollo + GraphCool Subcriptions

Programming Languages

javascript
184084 projects - #8 most used programming language
objective c
16641 projects - #2 most used programming language
python
139335 projects - #7 most used programming language
java
68154 projects - #9 most used programming language

Apollo + Graphcool Subscription Book App

To get started:

  1. Clone the repository
git clone https://github.com/dabit3/apollo-subscriptions-book-club.git
  1. cd into directory
cd apollo-subscriptions-book-club
  1. Install dependencies
yarn
# or npm install
  1. Install Graphcool CLI
npm install -g graphcool
  1. Create GraphQL server
graphcool init --schema ./schema.graphql --name BookClub

From the terminal output, you need to grab the project ID and use it in the next step. This ID is also available in the generated project file project.graphcool.

Note: If you need to find out the available endpoints for your project, you can simply use the graphcool endpoints command (in the directory where project.graphcool is located) or grab them from the Graphcool Console.

  1. Configure endpoints

Open app/index.js and set the projectId variable to your project ID from the previous step. The project ID will be used to configure the endpoints for the GraphQL API as well as for the subscriptions:

// Add your own project ID here
const projectId = '__YOUR_PROJECT_ID__'

// Endpoint for the Subscriptions API
const wsClient = new SubscriptionClient(`wss://subscriptions.graph.cool/v1/${projectId}`, {
  reconnect: true
});

// Endpoint for the regular GraphQL API
const networkInterface = createNetworkInterface({
  uri: `https://api.graph.cool/simple/v1/${projectId}`
});
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].