Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Sep 2, 2022. It is now read-only.

Commit bcc5e83

Browse files
author
Chris Nelson
committed
example github client
1 parent 45cf64d commit bcc5e83

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

‎src/githubClient.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
const githubToken = "redacted";
3+
4+
let networkInterface = createNetworkInterface('https://api.github.com/graphql');
5+
const client = new ApolloClient({
6+
// networkInterface: createNetworkInterface('http://localhost:53441/')
7+
networkInterface
8+
// networkInterface: createNetworkInterface('http://localhost:4000/graphql')
9+
// networkInterface: createNetworkInterface('https://www.graphqlhub.com/graphql')
10+
});
11+
// const client = new ApolloClient({
12+
// networkInterface: createNetworkInterface({ uri: 'http://localhost:4000/graphql' }),
13+
// });
14+
networkInterface.use([{
15+
applyMiddleware(req, next) {
16+
if (!req.options.headers) {
17+
req.options.headers = {}; // Create the header object if needed.
18+
}
19+
req.options.headers.authorization = `bearer ${githubToken}`;
20+
next();
21+
}
22+
}]);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /