Skip to content

Commit 4f6adf4

Browse files
committed
upgraded to apollo client 2.0 and the graphcool framework
1 parent ad36e3a commit 4f6adf4

File tree

238 files changed

+2309
-8588
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

238 files changed

+2309
-8588
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# See https://help.github.com/ignore-files/ for more about ignoring files.
22

33
# dependencies
4-
/node_modules
4+
node_modules
55

66
# testing
77
/coverage

README.md

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,44 @@
1+
# React & Apollo Tutorial
12

2-
## Run the app
3+
This is the sample project that belongs to the [React & Apollo Tutorial](https://www.howtographql.com/react-apollo/0-introduction/) on How to GraphQL.
4+
5+
## Running the App
6+
7+
### 1. Clone repository
8+
9+
```sh
10+
git clone https://github.com/howtographql/react-apollo/
11+
cd react-apollo
12+
```
13+
14+
### 2. Create GraphQL API with [`graphcool`](https://www.npmjs.com/package/graphcool)
15+
16+
If you haven't already, install the Graphcool CLI:
17+
18+
```sh
19+
# Install Graphcool CLI
20+
npm install -g graphcool
21+
```
22+
23+
Once it's installed, you can deploy the Graphcool service based on the existing definition inside the [`server`](./server) directory:
324

425
```sh
26+
cd server
527
yarn install
6-
yarn start
28+
graphcool deploy
729
```
30+
31+
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`).
32+
33+
### 3. Connect the app with your GraphQL API
34+
35+
Paste the service ID (which you find in the generated `.graphcoolrc` file inside the `server` directory or by running `graphcool info`) into `./src/index.js` replacing the current placeholder `__SERVICE_ID__`.
36+
37+
### 5. Install dependencies & run locally
38+
39+
```sh
40+
yarn install
41+
yarn start # open http://localhost:3000 in your browser
42+
```
43+
44+

package.json

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,17 @@
22
"name": "hackernews-react-apollo",
33
"version": "0.1.0",
44
"private": true,
5-
"devDependencies": {
6-
"react-scripts": "1.0.7"
7-
},
85
"dependencies": {
9-
"apollo-cache-inmemory": "^1.0.0",
10-
"apollo-client": "^2.0.1",
11-
"apollo-link-http": "^1.0.0",
6+
"apollo-client-preset": "^1.0.1",
127
"apollo-link-ws": "^1.0.0",
13-
"apollo-utilities": "^1.0.1",
148
"graphql": "^0.11.7",
159
"graphql-tag": "^2.5.0",
1610
"react": "^16.0.0",
1711
"react-apollo": "^2.0.0",
1812
"react-dom": "^16.0.0",
13+
"react-router": "^4.2.0",
1914
"react-router-dom": "^4.2.2",
20-
"subscriptions-transport-ws": "^0.8.2"
15+
"react-scripts": "1.0.17"
2116
},
2217
"scripts": {
2318
"start": "react-scripts start",

public/favicon.ico

-20.5 KB
Binary file not shown.

public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!doctype html>
1+
<!DOCTYPE html>
22
<html lang="en">
33
<head>
44
<meta charset="utf-8">

public/manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"icons": [
55
{
66
"src": "favicon.ico",
7-
"sizes": "192x192",
8-
"type": "image/png"
7+
"sizes": "64x64 32x32 24x24 16x16",
8+
"type": "image/x-icon"
99
}
1010
],
1111
"start_url": "./index.html",

schema.graphql

Lines changed: 0 additions & 16 deletions
This file was deleted.

server/.graphcoolrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
targets:
2-
iujyhtrgef: shared-eu-west-1/cj9gvy3ih0xkv0111bcc8sj1o
3-
default: iujyhtrgef
2+
ymtrvcesx: shared-eu-west-1/cj9nyjid25ne801126sksl862
3+
default: ymtrvcesx

server/graphcool.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ functions:
4040
handler:
4141
code: src/email-password/loggedInUser.ts
4242

43+
hello:
44+
handler:
45+
code: src/hello.js
46+
type: resolver
47+
schema: src/hello.graphql
48+
4349

4450
# Model/Relation permissions are used to limit the API access
4551
# To take the burden of thinking about those while development, we

server/node_modules/.yarn-integrity

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)