Skip to content

Commit fd067ec

Browse files
committed
01-Starting with Apollo Boost on the Command Line
1 parent 90f3929 commit fd067ec

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
"nodemon": "^1.18.4"
1818
},
1919
"dependencies": {
20-
"dotenv": "^6.1.0"
20+
"apollo-boost": "^0.1.17",
21+
"cross-fetch": "^2.2.2",
22+
"dotenv": "^6.1.0",
23+
"graphql": "^14.0.2"
2124
}
2225
}

src/index.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import 'dotenv/config';
2+
import 'cross-fetch/polyfill';
3+
import ApolloClient from 'apollo-boost';
4+
5+
const client = new ApolloClient({
6+
uri: 'https://api.github.com/graphql',
7+
request: operation => {
8+
operation.setContext({
9+
headers: {
10+
authorization: `Bearer ${process.env.GITHUB_PERSONAL_ACCESS_TOKEN}`,
11+
},
12+
});
13+
},
14+
});

0 commit comments

Comments
 (0)