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

Name: apollo-subscriptions-book-club

Owner: React Native Training

Description: Book Aggregation App using Apollo + GraphCool Subcriptions

Created: 2017-06-22 22:15:25.0

Updated: 2018-04-03 04:17:29.0

Pushed: 2017-06-26 23:53:20.0

Homepage: null

Size: 702

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Apollo + Graphcool Subscription Book App

To get started:
  1. Clone the repository
clone https://github.com/dabit3/apollo-subscriptions-book-club.git
  1. cd into directory
pollo-subscriptions-book-club
  1. Install dependencies

 npm install
  1. Install Graphcool CLI
install -g graphcool
  1. Create GraphQL server
hcool 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:

dd your own project ID here
t projectId = '__YOUR_PROJECT_ID__'

ndpoint for the Subscriptions API
t wsClient = new SubscriptionClient(`wss://subscriptions.graph.cool/v1/${projectId}`, {
connect: true


ndpoint for the regular GraphQL API
t networkInterface = createNetworkInterface({
i: `https://api.graph.cool/simple/v1/${projectId}`


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.