Created
July 31, 2018 13:12
-
-
Save lpellegr/256d6ebae5268e7dd21d679709937bee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const server = new ApolloServer({ | |
context: async ({req, res}) => { | |
const userQuotas = await checkAuthorization(req); | |
setRateLimitHeaders(res, userQuotas); | |
res.set('Cache-Control', 'public, max-age=150, s-maxage=300'); | |
return { | |
firestore: db, | |
projects: req['projects'], | |
scope: req['scope'], | |
userId: req['userId'] | |
} | |
}, | |
introspection: true, | |
playground: { | |
endpoint: 'http://localhost:5000/graphql', | |
settings: { | |
'editor.reuseHeaders': true | |
}, | |
tabs: [{ | |
query: '# Type queries into this side of the screen, and you will \n' + | |
'# see intelligent typeaheads aware of the current GraphQL type schema, \n' + | |
'# live syntax, and validation errors highlighted within the text.\n' + | |
'\n' + | |
'# This explorer is for testing purposes only.\n' + | |
'# You can perform requests with any HTTP or Graphql clients.\n' + | |
'# It includes cURL, HTTPie, Apollo Client, etc.\n\n' + | |
'# We\'ll get you started with a simple query fetching some projects and posts!\n' + | |
'query { \n' + | |
' viewer { \n' + | |
' id\n' + | |
' projects(first: 10) {\n' + | |
' pageInfo {\n' + | |
' hasNextPage\n' + | |
' }\n' + | |
' edges {\n' + | |
' node{\n' + | |
' name\n' + | |
' createdAt\n' + | |
' posts(last:5) {\n' + | |
' edges {\n' + | |
' node {\n' + | |
' id\n' + | |
' title\n' + | |
' createdAt\n' + | |
' }\n' + | |
' }\n' + | |
' }\n' + | |
' }\n' + | |
' }\n' + | |
' }\n' + | |
' }\n' + | |
'}', | |
headers: { | |
"Authorization": "Apikey EiHfb0NCrekI2risl27V" | |
} | |
}] | |
}, | |
resolvers: NoticeableResolvers, | |
typeDefs: NoticeableTypes | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment