├── src ├── react-app-env.d.ts ├── setupTests.ts ├── App.test.tsx ├── index.css ├── index.tsx ├── App.css ├── logo.svg ├── App.tsx ├── generated.tsx └── serviceWorker.ts ├── api ├── .funcignore ├── graphql │ ├── operations │ │ ├── questions.graphql │ │ └── answers.graphql │ ├── function.json │ ├── index.ts │ ├── schema.graphql │ ├── resolvers.ts │ ├── data.ts │ └── generated.ts ├── tsconfig.json ├── host.json ├── .gitignore ├── codegen.yml ├── package.json ├── trivia.json └── graphql.schema.json ├── .editorconfig ├── public ├── robots.txt ├── favicon.ico ├── logo192.png ├── logo512.png ├── manifest.json └── index.html ├── .vscode ├── extensions.json ├── yml.code-snippets ├── launch.json ├── graphql.code-snippets └── javascript.code-snippets ├── .gitignore ├── tsconfig.json ├── LICENSE ├── package.json └── README.md /src/react-app-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /api/.funcignore: -------------------------------------------------------------------------------- 1 | *.js.map 2 | *.ts 3 | .git* 4 | .vscode 5 | local.settings.json 6 | test -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | [*.*] 2 | indent_size = 2 3 | indent_style = space 4 | end_of_line = lf 5 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aaronpowell/graphql-code-generator-sample/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aaronpowell/graphql-code-generator-sample/HEAD/public/logo192.png -------------------------------------------------------------------------------- /public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aaronpowell/graphql-code-generator-sample/HEAD/public/logo512.png -------------------------------------------------------------------------------- /api/graphql/operations/questions.graphql: -------------------------------------------------------------------------------- 1 | query randomQuestion { 2 | getRandomQuestion { 3 | id 4 | question 5 | answers 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "ms-azuretools.vscode-azurefunctions", 4 | "ms-azuretools.vscode-azurestaticwebapps" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /api/graphql/operations/answers.graphql: -------------------------------------------------------------------------------- 1 | mutation answerQuestion($id: ID, $answer: String) { 2 | answerQuestion(id: $id, answer: $answer) { 3 | correct 4 | correctAnswer 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /api/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "outDir": "dist", 6 | "rootDir": ".", 7 | "sourceMap": true, 8 | "strict": false, 9 | "esModuleInterop": true 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/setupTests.ts: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom/extend-expect'; 6 | -------------------------------------------------------------------------------- /src/App.test.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render } from '@testing-library/react'; 3 | import App from './App'; 4 | 5 | test('renders learn react link', () => { 6 | const { getByText } = render(); 7 | const linkElement = getByText(/learn react/i); 8 | expect(linkElement).toBeInTheDocument(); 9 | }); 10 | -------------------------------------------------------------------------------- /api/host.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0", 3 | "logging": { 4 | "applicationInsights": { 5 | "samplingSettings": { 6 | "isEnabled": true, 7 | "excludedTypes": "Request" 8 | } 9 | } 10 | }, 11 | "extensionBundle": { 12 | "id": "Microsoft.Azure.Functions.ExtensionBundle", 13 | "version": "[1.*, 2.0.0)" 14 | } 15 | } -------------------------------------------------------------------------------- /api/graphql/function.json: -------------------------------------------------------------------------------- 1 | { 2 | "bindings": [ 3 | { 4 | "authLevel": "function", 5 | "type": "httpTrigger", 6 | "direction": "in", 7 | "name": "req", 8 | "methods": ["get", "post"] 9 | }, 10 | { 11 | "type": "http", 12 | "direction": "out", 13 | "name": "$return" 14 | } 15 | ], 16 | "scriptFile": "../dist/graphql/index.js" 17 | } 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /api/graphql/index.ts: -------------------------------------------------------------------------------- 1 | import { ApolloServer } from "apollo-server-azure-functions"; 2 | import { importSchema } from "graphql-import"; 3 | import resolvers from "./resolvers"; 4 | import { dataStore } from "./data"; 5 | 6 | const server = new ApolloServer({ 7 | typeDefs: importSchema("./graphql/schema.graphql"), 8 | resolvers, 9 | context: { 10 | dataStore, 11 | }, 12 | }); 13 | 14 | export default server.createHandler(); 15 | -------------------------------------------------------------------------------- /.vscode/yml.code-snippets: -------------------------------------------------------------------------------- 1 | { 2 | "React Hooks": { 3 | "scope": "yaml", 4 | "prefix": "react", 5 | "body": [ 6 | " ../src/generated.tsx:", 7 | " config:", 8 | " withHooks: true", 9 | " withHOC: false", 10 | " withComponent: false", 11 | " plugins:", 12 | " - \"typescript\"", 13 | " - \"typescript-react-apollo\"", 14 | " - \"typescript-operations\"" 15 | ] 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /api/graphql/schema.graphql: -------------------------------------------------------------------------------- 1 | type Question { 2 | id: ID! 3 | question: String! 4 | correctAnswer: String! 5 | answers: [String!]! 6 | } 7 | 8 | type Query { 9 | question(id: ID!): Question 10 | getRandomQuestion: Question 11 | } 12 | 13 | type Answer { 14 | questionId: ID 15 | question: String! 16 | submittedAnswer: String! 17 | correctAnswer: String! 18 | correct: Boolean 19 | } 20 | 21 | type Mutation { 22 | answerQuestion(id: ID, answer: String): Answer 23 | } 24 | 25 | schema { 26 | query: Query 27 | mutation: Mutation 28 | } 29 | 30 | -------------------------------------------------------------------------------- /src/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import './index.css'; 4 | import App from './App'; 5 | import * as serviceWorker from './serviceWorker'; 6 | 7 | ReactDOM.render( 8 | 9 | 10 | , 11 | document.getElementById('root') 12 | ); 13 | 14 | // If you want your app to work offline and load faster, you can change 15 | // unregister() to register() below. Note this comes with some pitfalls. 16 | // Learn more about service workers: https://bit.ly/CRA-PWA 17 | serviceWorker.unregister(); 18 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "command": "npm start", 6 | "name": "Run frontend", 7 | "request": "launch", 8 | "type": "node-terminal" 9 | }, 10 | { 11 | "command": "npm start", 12 | "name": "Run backend", 13 | "request": "launch", 14 | "type": "node-terminal", 15 | "cwd": "${workspaceFolder}/api" 16 | } 17 | ], 18 | "compounds": [ 19 | { 20 | "name": "Run full stack", 21 | "configurations": ["Run frontend", "Run backend"] 22 | } 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /api/.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | obj 3 | csx 4 | .vs 5 | edge 6 | Publish 7 | 8 | *.user 9 | *.suo 10 | *.cscfg 11 | *.Cache 12 | project.lock.json 13 | 14 | /packages 15 | /TestResults 16 | 17 | /tools/NuGet.exe 18 | /App_Data 19 | /secrets 20 | /data 21 | .secrets 22 | appsettings.json 23 | local.settings.json 24 | 25 | node_modules 26 | dist 27 | 28 | # Local python packages 29 | .python_packages/ 30 | 31 | # Python Environments 32 | .env 33 | .venv 34 | env/ 35 | venv/ 36 | ENV/ 37 | env.bak/ 38 | venv.bak/ 39 | 40 | # Byte-compiled / optimized / DLL files 41 | __pycache__/ 42 | *.py[cod] 43 | *$py.class -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": [ 5 | "dom", 6 | "dom.iterable", 7 | "esnext" 8 | ], 9 | "allowJs": true, 10 | "skipLibCheck": true, 11 | "esModuleInterop": true, 12 | "allowSyntheticDefaultImports": true, 13 | "strict": true, 14 | "forceConsistentCasingInFileNames": true, 15 | "module": "esnext", 16 | "moduleResolution": "node", 17 | "resolveJsonModule": true, 18 | "isolatedModules": true, 19 | "noEmit": true, 20 | "jsx": "react" 21 | }, 22 | "include": [ 23 | "src" 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /api/codegen.yml: -------------------------------------------------------------------------------- 1 | overwrite: true 2 | schema: "./graphql/schema.graphql" 3 | documents: "./graphql/operations/*.graphql" 4 | generates: 5 | graphql/generated.ts: 6 | config: 7 | contextType: "./data#Context" 8 | avoidOptionals: 9 | field: false 10 | inputValue: false 11 | object: false 12 | mappers: 13 | Question: ./data#QuestionModel 14 | plugins: 15 | - "typescript" 16 | - "typescript-resolvers" 17 | ./graphql.schema.json: 18 | plugins: 19 | - "introspection" 20 | ../src/generated.tsx: 21 | config: 22 | withHooks: true 23 | withHOC: false 24 | withComponent: false 25 | plugins: 26 | - "typescript" 27 | - "typescript-react-apollo" 28 | - "typescript-operations" 29 | -------------------------------------------------------------------------------- /src/App.css: -------------------------------------------------------------------------------- 1 | .App { 2 | text-align: center; 3 | } 4 | 5 | .App-logo { 6 | height: 40vmin; 7 | pointer-events: none; 8 | } 9 | 10 | @media (prefers-reduced-motion: no-preference) { 11 | .App-logo { 12 | animation: App-logo-spin infinite 20s linear; 13 | } 14 | } 15 | 16 | .App-header { 17 | background-color: #282c34; 18 | min-height: 100vh; 19 | display: flex; 20 | flex-direction: column; 21 | align-items: center; 22 | justify-content: center; 23 | font-size: calc(10px + 2vmin); 24 | color: white; 25 | } 26 | 27 | .App-link { 28 | color: #61dafb; 29 | } 30 | 31 | @keyframes App-logo-spin { 32 | from { 33 | transform: rotate(0deg); 34 | } 35 | to { 36 | transform: rotate(360deg); 37 | } 38 | } 39 | 40 | ul { 41 | list-style: none; 42 | } 43 | -------------------------------------------------------------------------------- /.vscode/graphql.code-snippets: -------------------------------------------------------------------------------- 1 | { 2 | "GraphQL types": { 3 | "scope": "graphql", 4 | "prefix": "types", 5 | "body": [ 6 | "type Question {", 7 | "id: ID!", 8 | "question: String!", 9 | "correctAnswer: String!", 10 | "answers: [String!]!", 11 | "}" 12 | ] 13 | }, 14 | 15 | "Schema": { 16 | "scope": "graphql", 17 | "prefix": "schema", 18 | "body": [ 19 | "type Query {", 20 | "\tquestion(id: ID!): Question", 21 | "\tgetRandomQuestion: Question", 22 | "}", 23 | "", 24 | "schema {", 25 | "\tquery: Query", 26 | "}" 27 | ] 28 | }, 29 | 30 | "Mutation": { 31 | "scope": "graphql", 32 | "prefix": "mutation", 33 | "body": [ 34 | "type Answer {", 35 | "\tquestionId: ID", 36 | "\tquestion: String!", 37 | "\tsubmittedAnswer: String!", 38 | "\tcorrectAnswer: String!", 39 | "\tcorrect: Boolean", 40 | "}", 41 | "", 42 | "type Mutation {", 43 | "\tanswerQuestion(id: ID, answer: String): Answer", 44 | "}" 45 | ] 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2020 Aaron Powell 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /api/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "", 3 | "version": "", 4 | "scripts": { 5 | "build": "tsc", 6 | "build:production": "npm run prestart && npm prune --production", 7 | "watch": "tsc --w", 8 | "prestart": "npm run build && func extensions install", 9 | "start:host": "func start", 10 | "start": "npm-run-all --parallel start:host watch", 11 | "test": "echo \"No tests yet...\"", 12 | "gen": "graphql-codegen --config codegen.yml" 13 | }, 14 | "description": "", 15 | "devDependencies": { 16 | "@azure/functions": "^1.0.1-beta1", 17 | "@graphql-codegen/cli": "1.16.2", 18 | "azure-functions-core-tools": "^3.0.2630", 19 | "npm-run-all": "^4.1.5", 20 | "typescript": "^3.3.3", 21 | "@graphql-codegen/typescript": "1.16.2", 22 | "@graphql-codegen/typescript-resolvers": "1.16.2", 23 | "@graphql-codegen/introspection": "1.16.2" 24 | }, 25 | "dependencies": { 26 | "@azure/cosmos": "^3.7.4", 27 | "@graphql-codegen/typescript-operations": "^1.16.2", 28 | "@graphql-codegen/typescript-react-apollo": "^1.16.2", 29 | "apollo-server-azure-functions": "^2.15.1", 30 | "axios": "^0.19.2", 31 | "graphql-import": "^1.0.2" 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "aswa-react-template", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@apollo/react-hooks": "^3.1.5", 7 | "@testing-library/jest-dom": "^4.2.4", 8 | "@testing-library/react": "^9.5.0", 9 | "@testing-library/user-event": "^7.2.1", 10 | "@types/jest": "^24.9.1", 11 | "@types/node": "^12.12.47", 12 | "@types/react": "^16.9.41", 13 | "@types/react-dom": "^16.9.8", 14 | "apollo-boost": "^0.4.9", 15 | "graphql": "^15.3.0", 16 | "graphql-tag": "^2.10.3", 17 | "react": "^16.13.1", 18 | "react-dom": "^16.13.1", 19 | "react-scripts": "3.4.1", 20 | "typescript": "^3.7.5" 21 | }, 22 | "scripts": { 23 | "start": "react-scripts start", 24 | "build": "react-scripts build", 25 | "test": "react-scripts test", 26 | "eject": "react-scripts eject" 27 | }, 28 | "eslintConfig": { 29 | "extends": "react-app" 30 | }, 31 | "browserslist": { 32 | "production": [ 33 | ">0.2%", 34 | "not dead", 35 | "not op_mini all" 36 | ], 37 | "development": [ 38 | "last 1 chrome version", 39 | "last 1 firefox version", 40 | "last 1 safari version" 41 | ] 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /api/graphql/resolvers.ts: -------------------------------------------------------------------------------- 1 | import { Resolvers } from "./generated"; 2 | 3 | const resolvers: Resolvers = { 4 | Query: { 5 | question(_, { id }, { dataStore }) { 6 | return dataStore.getQuestionById(id); 7 | }, 8 | async getRandomQuestion(_, __, { dataStore }) { 9 | const questions = await dataStore.getQuestions(); 10 | return questions[Math.floor(Math.random() * questions.length) + 1]; 11 | }, 12 | }, 13 | Question: { 14 | answers(question) { 15 | return question.incorrect_answers 16 | .concat([question.correct_answer]) 17 | .sort(); 18 | }, 19 | correctAnswer(question) { 20 | return question.correct_answer; 21 | }, 22 | id(question) { 23 | return question.id; 24 | }, 25 | question(question) { 26 | return question.question; 27 | }, 28 | }, 29 | 30 | Mutation: { 31 | async answerQuestion(_, { id, answer }, { dataStore }) { 32 | const question = await dataStore.getQuestionById(id); 33 | 34 | return { 35 | questionId: id, 36 | question: question.question, 37 | correctAnswer: question.correct_answer, 38 | submittedAnswer: answer, 39 | correct: question.correct_answer === answer, 40 | }; 41 | }, 42 | }, 43 | 44 | Answer: { 45 | correct({ correct }) { 46 | return correct; 47 | }, 48 | correctAnswer({ correctAnswer }) { 49 | return correctAnswer; 50 | }, 51 | question({ question }) { 52 | return question; 53 | }, 54 | questionId({ questionId }) { 55 | return questionId; 56 | }, 57 | submittedAnswer({ submittedAnswer }) { 58 | return submittedAnswer; 59 | }, 60 | }, 61 | }; 62 | 63 | export default resolvers; 64 | -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 17 | 18 | 27 | React App 28 | 29 | 30 | 31 |
32 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GraphQL Code Generator Sample App 2 | 3 | This is a sample application showing how to use [GraphQL Code Generator](https://graphql-code-generator.com/) to generate an the TypeScript definitions from a GraphQL schema, then how to combine that with a data store that uses a different data model. The backend storage model is [CosmosDB](https://azure.microsoft.com/services/cosmos-db/?WT.mc_id=javascript-0000-aapowell) by default, using the [`trivia.json`](api/trivia.json) data (the data was generated from [Open Trivia DB](https://opentdb.com)), but there is an in-memory store you can switch to by uncommenting code in `data.ts`. 4 | 5 | You can watch the video of the talk that this was presented at on the [BrisJS](https://brisjs.org) [YouTube Channel](https://youtu.be/p8aJqeX7TT4?t=2741). 6 | 7 | ## Azure Static Website React Template 8 | 9 | This repository contains a template for creating an [Azure Static Web App](https://docs.microsoft.com/azure/static-web-apps/?WT.mc_id=javascript-0000-aapowell) projects using React + TypeScript. 10 | 11 | In the template there is [Create React App](https://create-react-app.dev) site using TypeScript and an `api` folder with an empty [Azure Functions](https://docs.microsoft.com/azure/functions/?WT.mc_id=javascript-0000-aapowell), also using TypeScript. 12 | 13 | To get started, click the **Use this template** button to create a repository from this template, and check out the [GitHub docs on using templates](https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-repository-from-a-template). 14 | 15 | ## Running The Application 16 | 17 | From a terminal run `npm start` from both the repository root and `api` folder to start the two servers, the web application will be on `http://localhost:3000` and the API on `http://localhost:7071`. Alternatively, you can use the VS Code launch of `Run full stack` to run both together with debuggers attached. 18 | -------------------------------------------------------------------------------- /api/graphql/data.ts: -------------------------------------------------------------------------------- 1 | import { CosmosClient } from "@azure/cosmos"; 2 | 3 | export type QuestionModel = { 4 | id: string; 5 | question: string; 6 | category: string; 7 | incorrect_answers: string[]; 8 | correct_answer: string; 9 | type: string; 10 | difficulty: "easy" | "medium" | "hard"; 11 | }; 12 | 13 | interface DataStore { 14 | getQuestionById(id: string): Promise; 15 | getQuestions(): Promise; 16 | } 17 | 18 | class CosmosDataStore implements DataStore { 19 | #client: CosmosClient; 20 | #databaseName = "trivia"; 21 | #containerName = "questions"; 22 | 23 | #getContainer = () => { 24 | return this.#client 25 | .database(this.#databaseName) 26 | .container(this.#containerName); 27 | }; 28 | 29 | constructor(client: CosmosClient) { 30 | this.#client = client; 31 | } 32 | 33 | async getQuestionById(id: string) { 34 | const container = this.#getContainer(); 35 | 36 | const question = await container.items 37 | .query({ 38 | query: "SELECT * FROM c WHERE c.id = @id", 39 | parameters: [{ name: "@id", value: id }], 40 | }) 41 | .fetchAll(); 42 | 43 | return question.resources[0]; 44 | } 45 | 46 | async getQuestions() { 47 | const container = this.#getContainer(); 48 | 49 | const question = await container.items 50 | .query({ 51 | query: "SELECT * FROM c", 52 | }) 53 | .fetchAll(); 54 | 55 | return question.resources; 56 | } 57 | } 58 | 59 | class MockDataStore implements DataStore { 60 | #data: QuestionModel[]; 61 | constructor() { 62 | this.#data = require("../../trivia.json"); 63 | } 64 | 65 | getQuestionById(id: string): Promise { 66 | return Promise.resolve(this.#data.find((q) => q.id === id)); 67 | } 68 | getQuestions(): Promise { 69 | return Promise.resolve(this.#data); 70 | } 71 | } 72 | 73 | export const dataStore = new CosmosDataStore( 74 | new CosmosClient(process.env.CosmosDB) 75 | ); 76 | 77 | // export const dataStore = new MockDataStore(); 78 | 79 | export type Context = { 80 | dataStore: DataStore; 81 | }; 82 | -------------------------------------------------------------------------------- /src/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/App.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState, useEffect } from "react"; 2 | import logo from "./logo.svg"; 3 | import "./App.css"; 4 | import { 5 | useAnswerQuestionMutation, 6 | useRandomQuestionLazyQuery, 7 | Question, 8 | } from "./generated"; 9 | import ApolloClient from "apollo-boost"; 10 | 11 | const client = new ApolloClient({ 12 | uri: "http://localhost:7072/api/graphql", 13 | }); 14 | 15 | type QuestionProps = { 16 | question: Pick; 17 | setAnswer: (answer: string) => void; 18 | }; 19 | 20 | const QuestionDisplay: React.FC = ({ question, setAnswer }) => { 21 | return ( 22 | <> 23 |

24 |
    25 | {question.answers.map((a) => ( 26 |
  • 27 | 32 |
  • 33 | ))} 34 |
35 | 36 | ); 37 | }; 38 | 39 | function App() { 40 | const [getRandomQuestion, { loading, data }] = useRandomQuestionLazyQuery({ 41 | client, 42 | }); 43 | const [submitAnswer, submitAnswerResponse] = useAnswerQuestionMutation({ 44 | client, 45 | }); 46 | 47 | const [correct, setCorrect] = useState(false); 48 | const [answer, setAnswer] = useState(); 49 | 50 | useEffect(() => { 51 | if (submitAnswerResponse.data) { 52 | setCorrect(submitAnswerResponse.data.answerQuestion?.correct || false); 53 | } 54 | }, [submitAnswerResponse]); 55 | 56 | if (loading) { 57 | return ( 58 |
59 |
60 | logo 61 |

Loading...

62 |
63 |
64 | ); 65 | } 66 | 67 | if (!data || !data.getRandomQuestion) { 68 | return ( 69 |
70 |
71 | 72 |
73 |
74 | ); 75 | } 76 | 77 | return ( 78 |
79 |
80 | 84 | 94 | {submitAnswerResponse.called && !submitAnswerResponse.loading && ( 95 |

{correct ? "Correct!" : "Try again!"}

96 | )} 97 |
98 |
99 | ); 100 | } 101 | 102 | export default App; 103 | -------------------------------------------------------------------------------- /.vscode/javascript.code-snippets: -------------------------------------------------------------------------------- 1 | { 2 | "Azure Function": { 3 | "scope": "typescript", 4 | "prefix": "graphql-func", 5 | "body": [ 6 | "import { ApolloServer } from \"apollo-server-azure-functions\";", 7 | "import { importSchema } from \"graphql-import\";", 8 | "import resolvers from \"./resolvers\";", 9 | "", 10 | "const server = new ApolloServer({", 11 | "\ttypeDefs: importSchema(\"./graphql/schema.graphql\"),", 12 | "\tresolvers,", 13 | "});", 14 | "", 15 | "export default server.createHandler();" 16 | ] 17 | }, 18 | 19 | "Data Store": { 20 | "scope": "typescript", 21 | "prefix": "ds-impl", 22 | "body": [ 23 | "import { CosmosClient } from \"@azure/cosmos\";", 24 | "import { Question } from \"./generated\";", 25 | "", 26 | "class DataStore {", 27 | "\t#client: CosmosClient;", 28 | "\t#databaseName = \"trivia\";", 29 | "\t#containerName = \"questions\";", 30 | "", 31 | "#getContainer = () => {", 32 | "\treturn this.#client", 33 | "\t\t.database(this.#databaseName)", 34 | "\t\t.container(this.#containerName);", 35 | "\t};", 36 | "", 37 | "\tconstructor(client: CosmosClient) {", 38 | "\t\tthis.#client = client;", 39 | "\t}", 40 | "", 41 | "\tasync getQuestionById(id: string) {", 42 | "\t\tconst container = this.#getContainer();", 43 | "", 44 | "\t\tconst question = await container.items", 45 | "\t\t\t.query({", 46 | "\t\t\t\tquery: \"SELECT * FROM c WHERE c.id = @id\",", 47 | "\t\t\t\tparameters: [{ name: \"@id\", value: id }],", 48 | "\t\t\t})", 49 | "\t\t\t.fetchAll();", 50 | "", 51 | "\t\treturn question.resources[0];", 52 | "\t}", 53 | "}", 54 | "", 55 | "export const dataStore = new DataStore(new CosmosClient(process.env.CosmosDB));", 56 | "", 57 | "export type Context = {", 58 | "\tdataStore: DataStore;", 59 | "};" 60 | ] 61 | }, 62 | 63 | "Random Question": { 64 | "scope": "typescript", 65 | "prefix": "random", 66 | "body": [ 67 | "async getQuestions() {", 68 | "\tconst container = this.#getContainer();", 69 | "", 70 | "\tconst question = await container.items", 71 | "\t\t.query({", 72 | "\t\t\tquery: \"SELECT * FROM c\",", 73 | "\t\t})", 74 | "\t\t.fetchAll();", 75 | "", 76 | "\treturn question.resources;", 77 | "}" 78 | ] 79 | }, 80 | 81 | "Question Resolver": { 82 | "scope": "typescript", 83 | "prefix": "Question", 84 | "body": [ 85 | "Question: {", 86 | "\tanswers(question) {", 87 | "\t\treturn question.answers;", 88 | "\t},", 89 | "\tcorrectAnswer(question) {", 90 | "\t\treturn question.correctAnswer;", 91 | "\t},", 92 | "\tid(question) {", 93 | "\t\treturn question.id;", 94 | "\t},", 95 | "\tquestion(question) {", 96 | "\t\treturn question.question;", 97 | "\t},", 98 | "}," 99 | ] 100 | }, 101 | 102 | "QuestionModel": { 103 | "scope": "typescript", 104 | "prefix": "QuestionModel", 105 | "body": [ 106 | "export type QuestionModel = {", 107 | "\tid: string;", 108 | "\tquestion: string;", 109 | "\tcategory: string;", 110 | "\tincorrect_answers: string[];", 111 | "\tcorrect_answer: string;", 112 | "\ttype: string;", 113 | "\tdifficulty: \"easy\" | \"medium\" | \"hard\";", 114 | "};" 115 | ] 116 | }, 117 | 118 | "Mutation": { 119 | "scope": "typescript", 120 | "prefix": "Mutation", 121 | "body": [ 122 | "Mutation: {", 123 | "\tasync answerQuestion(_, { id, answer }, { dataStore }) {", 124 | "\tconst question = await dataStore.getQuestionById(id);", 125 | "", 126 | "\treturn {", 127 | "\tquestionId: id,", 128 | "\tquestion: question.question,", 129 | "\tcorrectAnswer: question.correct_answer,", 130 | "\tsubmittedAnswer: answer,", 131 | "\tcorrect: question.correct_answer === answer,", 132 | "\t};", 133 | "\t},", 134 | "}," 135 | ] 136 | }, 137 | 138 | "Answer Resolver": { 139 | "prefix": "Answer", 140 | "scope": "typescript", 141 | "body": [ 142 | "Answer: {", 143 | " correct({ correct }) {", 144 | " return correct;", 145 | " },", 146 | " correctAnswer({ correctAnswer }) {", 147 | " return correctAnswer;", 148 | " },", 149 | " question({ question }) {", 150 | " return question;", 151 | " },", 152 | " questionId({ questionId }) {", 153 | " return questionId;", 154 | " },", 155 | " submittedAnswer({ submittedAnswer }) {", 156 | " return submittedAnswer;", 157 | " },", 158 | "}," 159 | ] 160 | } 161 | } 162 | -------------------------------------------------------------------------------- /src/generated.tsx: -------------------------------------------------------------------------------- 1 | import gql from 'graphql-tag'; 2 | import * as ApolloReactCommon from '@apollo/react-common'; 3 | import * as ApolloReactHooks from '@apollo/react-hooks'; 4 | export type Maybe = T | null; 5 | export type Exact = { [K in keyof T]: T[K] }; 6 | /** All built-in and custom scalars, mapped to their actual values */ 7 | export type Scalars = { 8 | ID: string; 9 | String: string; 10 | Boolean: boolean; 11 | Int: number; 12 | Float: number; 13 | }; 14 | 15 | export type Answer = { 16 | __typename?: 'Answer'; 17 | questionId?: Maybe; 18 | question: Scalars['String']; 19 | submittedAnswer: Scalars['String']; 20 | correctAnswer: Scalars['String']; 21 | correct?: Maybe; 22 | }; 23 | 24 | export type Mutation = { 25 | __typename?: 'Mutation'; 26 | answerQuestion?: Maybe; 27 | }; 28 | 29 | 30 | export type MutationAnswerQuestionArgs = { 31 | id?: Maybe; 32 | answer?: Maybe; 33 | }; 34 | 35 | export type Query = { 36 | __typename?: 'Query'; 37 | question?: Maybe; 38 | getRandomQuestion?: Maybe; 39 | }; 40 | 41 | 42 | export type QueryQuestionArgs = { 43 | id: Scalars['ID']; 44 | }; 45 | 46 | export type Question = { 47 | __typename?: 'Question'; 48 | id: Scalars['ID']; 49 | question: Scalars['String']; 50 | correctAnswer: Scalars['String']; 51 | answers: Array; 52 | }; 53 | 54 | 55 | export const AnswerQuestionDocument = gql` 56 | mutation answerQuestion($id: ID, $answer: String) { 57 | answerQuestion(id: $id, answer: $answer) { 58 | correct 59 | correctAnswer 60 | } 61 | } 62 | `; 63 | export type AnswerQuestionMutationFn = ApolloReactCommon.MutationFunction; 64 | 65 | /** 66 | * __useAnswerQuestionMutation__ 67 | * 68 | * To run a mutation, you first call `useAnswerQuestionMutation` within a React component and pass it any options that fit your needs. 69 | * When your component renders, `useAnswerQuestionMutation` returns a tuple that includes: 70 | * - A mutate function that you can call at any time to execute the mutation 71 | * - An object with fields that represent the current status of the mutation's execution 72 | * 73 | * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; 74 | * 75 | * @example 76 | * const [answerQuestionMutation, { data, loading, error }] = useAnswerQuestionMutation({ 77 | * variables: { 78 | * id: // value for 'id' 79 | * answer: // value for 'answer' 80 | * }, 81 | * }); 82 | */ 83 | export function useAnswerQuestionMutation(baseOptions?: ApolloReactHooks.MutationHookOptions) { 84 | return ApolloReactHooks.useMutation(AnswerQuestionDocument, baseOptions); 85 | } 86 | export type AnswerQuestionMutationHookResult = ReturnType; 87 | export type AnswerQuestionMutationResult = ApolloReactCommon.MutationResult; 88 | export type AnswerQuestionMutationOptions = ApolloReactCommon.BaseMutationOptions; 89 | export const RandomQuestionDocument = gql` 90 | query randomQuestion { 91 | getRandomQuestion { 92 | id 93 | question 94 | answers 95 | } 96 | } 97 | `; 98 | 99 | /** 100 | * __useRandomQuestionQuery__ 101 | * 102 | * To run a query within a React component, call `useRandomQuestionQuery` and pass it any options that fit your needs. 103 | * When your component renders, `useRandomQuestionQuery` returns an object from Apollo Client that contains loading, error, and data properties 104 | * you can use to render your UI. 105 | * 106 | * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; 107 | * 108 | * @example 109 | * const { data, loading, error } = useRandomQuestionQuery({ 110 | * variables: { 111 | * }, 112 | * }); 113 | */ 114 | export function useRandomQuestionQuery(baseOptions?: ApolloReactHooks.QueryHookOptions) { 115 | return ApolloReactHooks.useQuery(RandomQuestionDocument, baseOptions); 116 | } 117 | export function useRandomQuestionLazyQuery(baseOptions?: ApolloReactHooks.LazyQueryHookOptions) { 118 | return ApolloReactHooks.useLazyQuery(RandomQuestionDocument, baseOptions); 119 | } 120 | export type RandomQuestionQueryHookResult = ReturnType; 121 | export type RandomQuestionLazyQueryHookResult = ReturnType; 122 | export type RandomQuestionQueryResult = ApolloReactCommon.QueryResult; 123 | export type AnswerQuestionMutationVariables = Exact<{ 124 | id?: Maybe; 125 | answer?: Maybe; 126 | }>; 127 | 128 | 129 | export type AnswerQuestionMutation = ( 130 | { __typename?: 'Mutation' } 131 | & { answerQuestion?: Maybe<( 132 | { __typename?: 'Answer' } 133 | & Pick 134 | )> } 135 | ); 136 | 137 | export type RandomQuestionQueryVariables = Exact<{ [key: string]: never; }>; 138 | 139 | 140 | export type RandomQuestionQuery = ( 141 | { __typename?: 'Query' } 142 | & { getRandomQuestion?: Maybe<( 143 | { __typename?: 'Question' } 144 | & Pick 145 | )> } 146 | ); 147 | -------------------------------------------------------------------------------- /src/serviceWorker.ts: -------------------------------------------------------------------------------- 1 | // This optional code is used to register a service worker. 2 | // register() is not called by default. 3 | 4 | // This lets the app load faster on subsequent visits in production, and gives 5 | // it offline capabilities. However, it also means that developers (and users) 6 | // will only see deployed updates on subsequent visits to a page, after all the 7 | // existing tabs open on the page have been closed, since previously cached 8 | // resources are updated in the background. 9 | 10 | // To learn more about the benefits of this model and instructions on how to 11 | // opt-in, read https://bit.ly/CRA-PWA 12 | 13 | const isLocalhost = Boolean( 14 | window.location.hostname === 'localhost' || 15 | // [::1] is the IPv6 localhost address. 16 | window.location.hostname === '[::1]' || 17 | // 127.0.0.0/8 are considered localhost for IPv4. 18 | window.location.hostname.match( 19 | /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ 20 | ) 21 | ); 22 | 23 | type Config = { 24 | onSuccess?: (registration: ServiceWorkerRegistration) => void; 25 | onUpdate?: (registration: ServiceWorkerRegistration) => void; 26 | }; 27 | 28 | export function register(config?: Config) { 29 | if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { 30 | // The URL constructor is available in all browsers that support SW. 31 | const publicUrl = new URL( 32 | process.env.PUBLIC_URL, 33 | window.location.href 34 | ); 35 | if (publicUrl.origin !== window.location.origin) { 36 | // Our service worker won't work if PUBLIC_URL is on a different origin 37 | // from what our page is served on. This might happen if a CDN is used to 38 | // serve assets; see https://github.com/facebook/create-react-app/issues/2374 39 | return; 40 | } 41 | 42 | window.addEventListener('load', () => { 43 | const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; 44 | 45 | if (isLocalhost) { 46 | // This is running on localhost. Let's check if a service worker still exists or not. 47 | checkValidServiceWorker(swUrl, config); 48 | 49 | // Add some additional logging to localhost, pointing developers to the 50 | // service worker/PWA documentation. 51 | navigator.serviceWorker.ready.then(() => { 52 | console.log( 53 | 'This web app is being served cache-first by a service ' + 54 | 'worker. To learn more, visit https://bit.ly/CRA-PWA' 55 | ); 56 | }); 57 | } else { 58 | // Is not localhost. Just register service worker 59 | registerValidSW(swUrl, config); 60 | } 61 | }); 62 | } 63 | } 64 | 65 | function registerValidSW(swUrl: string, config?: Config) { 66 | navigator.serviceWorker 67 | .register(swUrl) 68 | .then(registration => { 69 | registration.onupdatefound = () => { 70 | const installingWorker = registration.installing; 71 | if (installingWorker == null) { 72 | return; 73 | } 74 | installingWorker.onstatechange = () => { 75 | if (installingWorker.state === 'installed') { 76 | if (navigator.serviceWorker.controller) { 77 | // At this point, the updated precached content has been fetched, 78 | // but the previous service worker will still serve the older 79 | // content until all client tabs are closed. 80 | console.log( 81 | 'New content is available and will be used when all ' + 82 | 'tabs for this page are closed. See https://bit.ly/CRA-PWA.' 83 | ); 84 | 85 | // Execute callback 86 | if (config && config.onUpdate) { 87 | config.onUpdate(registration); 88 | } 89 | } else { 90 | // At this point, everything has been precached. 91 | // It's the perfect time to display a 92 | // "Content is cached for offline use." message. 93 | console.log('Content is cached for offline use.'); 94 | 95 | // Execute callback 96 | if (config && config.onSuccess) { 97 | config.onSuccess(registration); 98 | } 99 | } 100 | } 101 | }; 102 | }; 103 | }) 104 | .catch(error => { 105 | console.error('Error during service worker registration:', error); 106 | }); 107 | } 108 | 109 | function checkValidServiceWorker(swUrl: string, config?: Config) { 110 | // Check if the service worker can be found. If it can't reload the page. 111 | fetch(swUrl, { 112 | headers: { 'Service-Worker': 'script' } 113 | }) 114 | .then(response => { 115 | // Ensure service worker exists, and that we really are getting a JS file. 116 | const contentType = response.headers.get('content-type'); 117 | if ( 118 | response.status === 404 || 119 | (contentType != null && contentType.indexOf('javascript') === -1) 120 | ) { 121 | // No service worker found. Probably a different app. Reload the page. 122 | navigator.serviceWorker.ready.then(registration => { 123 | registration.unregister().then(() => { 124 | window.location.reload(); 125 | }); 126 | }); 127 | } else { 128 | // Service worker found. Proceed as normal. 129 | registerValidSW(swUrl, config); 130 | } 131 | }) 132 | .catch(() => { 133 | console.log( 134 | 'No internet connection found. App is running in offline mode.' 135 | ); 136 | }); 137 | } 138 | 139 | export function unregister() { 140 | if ('serviceWorker' in navigator) { 141 | navigator.serviceWorker.ready 142 | .then(registration => { 143 | registration.unregister(); 144 | }) 145 | .catch(error => { 146 | console.error(error.message); 147 | }); 148 | } 149 | } 150 | -------------------------------------------------------------------------------- /api/graphql/generated.ts: -------------------------------------------------------------------------------- 1 | import { GraphQLResolveInfo } from 'graphql'; 2 | import { QuestionModel, Context } from './data'; 3 | export type Maybe = T | null; 4 | export type Exact = { [K in keyof T]: T[K] }; 5 | export type RequireFields = { [X in Exclude]?: T[X] } & { [P in K]-?: NonNullable }; 6 | /** All built-in and custom scalars, mapped to their actual values */ 7 | export type Scalars = { 8 | ID: string; 9 | String: string; 10 | Boolean: boolean; 11 | Int: number; 12 | Float: number; 13 | }; 14 | 15 | export type Answer = { 16 | __typename?: 'Answer'; 17 | questionId?: Maybe; 18 | question: Scalars['String']; 19 | submittedAnswer: Scalars['String']; 20 | correctAnswer: Scalars['String']; 21 | correct?: Maybe; 22 | }; 23 | 24 | export type Mutation = { 25 | __typename?: 'Mutation'; 26 | answerQuestion?: Maybe; 27 | }; 28 | 29 | 30 | export type MutationAnswerQuestionArgs = { 31 | id?: Maybe; 32 | answer?: Maybe; 33 | }; 34 | 35 | export type Query = { 36 | __typename?: 'Query'; 37 | question?: Maybe; 38 | getRandomQuestion?: Maybe; 39 | }; 40 | 41 | 42 | export type QueryQuestionArgs = { 43 | id: Scalars['ID']; 44 | }; 45 | 46 | export type Question = { 47 | __typename?: 'Question'; 48 | id: Scalars['ID']; 49 | question: Scalars['String']; 50 | correctAnswer: Scalars['String']; 51 | answers: Array; 52 | }; 53 | 54 | 55 | 56 | export type ResolverTypeWrapper = Promise | T; 57 | 58 | 59 | export type LegacyStitchingResolver = { 60 | fragment: string; 61 | resolve: ResolverFn; 62 | }; 63 | 64 | export type NewStitchingResolver = { 65 | selectionSet: string; 66 | resolve: ResolverFn; 67 | }; 68 | export type StitchingResolver = LegacyStitchingResolver | NewStitchingResolver; 69 | export type Resolver = 70 | | ResolverFn 71 | | StitchingResolver; 72 | 73 | export type ResolverFn = ( 74 | parent: TParent, 75 | args: TArgs, 76 | context: TContext, 77 | info: GraphQLResolveInfo 78 | ) => Promise | TResult; 79 | 80 | export type SubscriptionSubscribeFn = ( 81 | parent: TParent, 82 | args: TArgs, 83 | context: TContext, 84 | info: GraphQLResolveInfo 85 | ) => AsyncIterator | Promise>; 86 | 87 | export type SubscriptionResolveFn = ( 88 | parent: TParent, 89 | args: TArgs, 90 | context: TContext, 91 | info: GraphQLResolveInfo 92 | ) => TResult | Promise; 93 | 94 | export interface SubscriptionSubscriberObject { 95 | subscribe: SubscriptionSubscribeFn<{ [key in TKey]: TResult }, TParent, TContext, TArgs>; 96 | resolve?: SubscriptionResolveFn; 97 | } 98 | 99 | export interface SubscriptionResolverObject { 100 | subscribe: SubscriptionSubscribeFn; 101 | resolve: SubscriptionResolveFn; 102 | } 103 | 104 | export type SubscriptionObject = 105 | | SubscriptionSubscriberObject 106 | | SubscriptionResolverObject; 107 | 108 | export type SubscriptionResolver = 109 | | ((...args: any[]) => SubscriptionObject) 110 | | SubscriptionObject; 111 | 112 | export type TypeResolveFn = ( 113 | parent: TParent, 114 | context: TContext, 115 | info: GraphQLResolveInfo 116 | ) => Maybe | Promise>; 117 | 118 | export type IsTypeOfResolverFn = (obj: T, info: GraphQLResolveInfo) => boolean | Promise; 119 | 120 | export type NextResolverFn = () => Promise; 121 | 122 | export type DirectiveResolverFn = ( 123 | next: NextResolverFn, 124 | parent: TParent, 125 | args: TArgs, 126 | context: TContext, 127 | info: GraphQLResolveInfo 128 | ) => TResult | Promise; 129 | 130 | /** Mapping between all available schema types and the resolvers types */ 131 | export type ResolversTypes = { 132 | Query: ResolverTypeWrapper<{}>; 133 | ID: ResolverTypeWrapper; 134 | Question: ResolverTypeWrapper; 135 | String: ResolverTypeWrapper; 136 | Mutation: ResolverTypeWrapper<{}>; 137 | Answer: ResolverTypeWrapper; 138 | Boolean: ResolverTypeWrapper; 139 | }; 140 | 141 | /** Mapping between all available schema types and the resolvers parents */ 142 | export type ResolversParentTypes = { 143 | Query: {}; 144 | ID: Scalars['ID']; 145 | Question: QuestionModel; 146 | String: Scalars['String']; 147 | Mutation: {}; 148 | Answer: Answer; 149 | Boolean: Scalars['Boolean']; 150 | }; 151 | 152 | export type AnswerResolvers = { 153 | questionId: Resolver, ParentType, ContextType>; 154 | question: Resolver; 155 | submittedAnswer: Resolver; 156 | correctAnswer: Resolver; 157 | correct: Resolver, ParentType, ContextType>; 158 | __isTypeOf?: IsTypeOfResolverFn; 159 | }; 160 | 161 | export type MutationResolvers = { 162 | answerQuestion: Resolver, ParentType, ContextType, RequireFields>; 163 | }; 164 | 165 | export type QueryResolvers = { 166 | question: Resolver, ParentType, ContextType, RequireFields>; 167 | getRandomQuestion: Resolver, ParentType, ContextType>; 168 | }; 169 | 170 | export type QuestionResolvers = { 171 | id: Resolver; 172 | question: Resolver; 173 | correctAnswer: Resolver; 174 | answers: Resolver, ParentType, ContextType>; 175 | __isTypeOf?: IsTypeOfResolverFn; 176 | }; 177 | 178 | export type Resolvers = { 179 | Answer: AnswerResolvers; 180 | Mutation: MutationResolvers; 181 | Query: QueryResolvers; 182 | Question: QuestionResolvers; 183 | }; 184 | 185 | 186 | /** 187 | * @deprecated 188 | * Use "Resolvers" root object instead. If you wish to get "IResolvers", add "typesPrefix: I" to your config. 189 | */ 190 | export type IResolvers = Resolvers; 191 | -------------------------------------------------------------------------------- /api/trivia.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": "0", 4 | "category": "Science: Computers", 5 | "type": "multiple", 6 | "difficulty": "easy", 7 | "question": "What does CPU stand for?", 8 | "correct_answer": "Central Processing Unit", 9 | "incorrect_answers": [ 10 | "Central Process Unit", 11 | "Computer Personal Unit", 12 | "Central Processor Unit" 13 | ] 14 | }, 15 | { 16 | "id": "1", 17 | "category": "Science: Computers", 18 | "type": "multiple", 19 | "difficulty": "medium", 20 | "question": "What does AD stand for in relation to Windows Operating Systems? ", 21 | "correct_answer": "Active Directory", 22 | "incorrect_answers": [ 23 | "Alternative Drive", 24 | "Automated Database", 25 | "Active Department" 26 | ] 27 | }, 28 | { 29 | "id": "2", 30 | "category": "Science: Computers", 31 | "type": "multiple", 32 | "difficulty": "medium", 33 | "question": "When was the programming language "C#" released?", 34 | "correct_answer": "2000", 35 | "incorrect_answers": ["1998", "1999", "2001"] 36 | }, 37 | { 38 | "id": "3", 39 | "category": "Science: Computers", 40 | "type": "multiple", 41 | "difficulty": "easy", 42 | "question": "What amount of bits commonly equals one byte?", 43 | "correct_answer": "8", 44 | "incorrect_answers": ["1", "2", "64"] 45 | }, 46 | { 47 | "id": "4", 48 | "category": "Science: Computers", 49 | "type": "multiple", 50 | "difficulty": "medium", 51 | "question": "Which of the following languages is used as a scripting language in the Unity 3D game engine?", 52 | "correct_answer": "C#", 53 | "incorrect_answers": ["Java", "C++", "Objective-C"] 54 | }, 55 | { 56 | "id": "5", 57 | "category": "Science: Computers", 58 | "type": "multiple", 59 | "difficulty": "easy", 60 | "question": "If you were to code software in this language you'd only be able to type 0's and 1's.", 61 | "correct_answer": "Binary", 62 | "incorrect_answers": ["JavaScript", "C++", "Python"] 63 | }, 64 | { 65 | "id": "6", 66 | "category": "Science: Computers", 67 | "type": "multiple", 68 | "difficulty": "easy", 69 | "question": "What is the most preferred image format used for logos in the Wikimedia database?", 70 | "correct_answer": ".svg", 71 | "incorrect_answers": [".png", ".jpeg", ".gif"] 72 | }, 73 | { 74 | "id": "7", 75 | "category": "Science: Computers", 76 | "type": "multiple", 77 | "difficulty": "medium", 78 | "question": "What was the first commerically available computer processor?", 79 | "correct_answer": "Intel 4004", 80 | "incorrect_answers": ["Intel 486SX", "TMS 1000", "AMD AM386"] 81 | }, 82 | { 83 | "id": "8", 84 | "category": "Science: Computers", 85 | "type": "multiple", 86 | "difficulty": "easy", 87 | "question": "In web design, what does CSS stand for?", 88 | "correct_answer": "Cascading Style Sheet", 89 | "incorrect_answers": [ 90 | "Counter Strike: Source", 91 | "Corrective Style Sheet", 92 | "Computer Style Sheet" 93 | ] 94 | }, 95 | { 96 | "id": "9", 97 | "category": "Science: Computers", 98 | "type": "multiple", 99 | "difficulty": "easy", 100 | "question": "What is the domain name for the country Tuvalu?", 101 | "correct_answer": ".tv", 102 | "incorrect_answers": [".tu", ".tt", ".tl"] 103 | }, 104 | { 105 | "id": "10", 106 | "category": "Science: Computers", 107 | "type": "multiple", 108 | "difficulty": "medium", 109 | "question": "While Apple was formed in California, in which western state was Microsoft founded?", 110 | "correct_answer": "New Mexico", 111 | "incorrect_answers": ["Washington", "Colorado", "Arizona"] 112 | }, 113 | { 114 | "id": "11", 115 | "category": "Science: Computers", 116 | "type": "multiple", 117 | "difficulty": "medium", 118 | "question": "What does the acronym CDN stand for in terms of networking?", 119 | "correct_answer": "Content Delivery Network", 120 | "incorrect_answers": [ 121 | "Content Distribution Network", 122 | "Computational Data Network", 123 | "Compressed Data Network" 124 | ] 125 | }, 126 | { 127 | "id": "12", 128 | "category": "Science: Computers", 129 | "type": "multiple", 130 | "difficulty": "medium", 131 | "question": "How many cores does the Intel i7-6950X have?", 132 | "correct_answer": "10", 133 | "incorrect_answers": ["12", "8", "4"] 134 | }, 135 | { 136 | "id": "13", 137 | "category": "Science: Computers", 138 | "type": "multiple", 139 | "difficulty": "medium", 140 | "question": "In the server hosting industry IaaS stands for...", 141 | "correct_answer": "Infrastructure as a Service", 142 | "incorrect_answers": [ 143 | "Internet as a Service", 144 | "Internet and a Server", 145 | "Infrastructure as a Server" 146 | ] 147 | }, 148 | { 149 | "id": "14", 150 | "category": "Science: Computers", 151 | "type": "multiple", 152 | "difficulty": "medium", 153 | "question": "Which coding language was the #1 programming language in terms of usage on GitHub in 2015?", 154 | "correct_answer": "JavaScript", 155 | "incorrect_answers": ["C#", "Python", "PHP"] 156 | }, 157 | { 158 | "id": "15", 159 | "category": "Science: Computers", 160 | "type": "multiple", 161 | "difficulty": "hard", 162 | "question": "What port does HTTP run on?", 163 | "correct_answer": "80", 164 | "incorrect_answers": ["53", "443", "23"] 165 | }, 166 | { 167 | "id": "16", 168 | "category": "Science: Computers", 169 | "type": "multiple", 170 | "difficulty": "medium", 171 | "question": "In HTML, which non-standard tag used to be be used to make elements scroll across the viewport?", 172 | "correct_answer": "<marquee></marquee>", 173 | "incorrect_answers": [ 174 | "<scroll></scroll>", 175 | "<move></move>", 176 | "<slide></slide>" 177 | ] 178 | }, 179 | { 180 | "id": "17", 181 | "category": "Science: Computers", 182 | "type": "multiple", 183 | "difficulty": "hard", 184 | "question": "Which of these was the name of a bug found in April 2014 in the publicly available OpenSSL cryptography library?", 185 | "correct_answer": "Heartbleed", 186 | "incorrect_answers": ["Shellshock", "Corrupted Blood", "Shellscript"] 187 | }, 188 | { 189 | "id": "18", 190 | "category": "Science: Computers", 191 | "type": "multiple", 192 | "difficulty": "easy", 193 | "question": "In "Hexadecimal", what color would be displayed from the color code? "#00FF00"?", 194 | "correct_answer": "Green", 195 | "incorrect_answers": ["Red", "Blue", "Yellow"] 196 | }, 197 | { 198 | "id": "19", 199 | "category": "Science: Computers", 200 | "type": "multiple", 201 | "difficulty": "medium", 202 | "question": "Which of these programming languages is a low-level language?", 203 | "correct_answer": "Assembly", 204 | "incorrect_answers": ["Python", "C#", "Pascal"] 205 | }, 206 | { 207 | "id": "20", 208 | "category": "Science: Computers", 209 | "type": "multiple", 210 | "difficulty": "medium", 211 | "question": "In computing terms, typically what does CLI stand for?", 212 | "correct_answer": "Command Line Interface", 213 | "incorrect_answers": [ 214 | "Common Language Input", 215 | "Control Line Interface", 216 | "Common Language Interface" 217 | ] 218 | }, 219 | { 220 | "id": "21", 221 | "category": "Science: Computers", 222 | "type": "multiple", 223 | "difficulty": "medium", 224 | "question": "What does "LCD" stand for?", 225 | "correct_answer": "Liquid Crystal Display", 226 | "incorrect_answers": [ 227 | "Language Control Design", 228 | "Last Common Difference", 229 | "Long Continuous Design" 230 | ] 231 | }, 232 | { 233 | "id": "22", 234 | "category": "Science: Computers", 235 | "type": "multiple", 236 | "difficulty": "hard", 237 | "question": "Who is the original author of the realtime physics engine called PhysX?", 238 | "correct_answer": "NovodeX", 239 | "incorrect_answers": ["Ageia", "Nvidia", "AMD"] 240 | }, 241 | { 242 | "id": "23", 243 | "category": "Science: Computers", 244 | "type": "multiple", 245 | "difficulty": "medium", 246 | "question": "Which of the following is a personal computer made by the Japanese company Fujitsu?", 247 | "correct_answer": "FM-7", 248 | "incorrect_answers": ["PC-9801", "Xmillennium ", "MSX"] 249 | }, 250 | { 251 | "id": "24", 252 | "category": "Science: Computers", 253 | "type": "multiple", 254 | "difficulty": "medium", 255 | "question": ".rs is the top-level domain for what country?", 256 | "correct_answer": "Serbia", 257 | "incorrect_answers": ["Romania", "Russia", "Rwanda"] 258 | }, 259 | { 260 | "id": "25", 261 | "category": "Science: Computers", 262 | "type": "multiple", 263 | "difficulty": "medium", 264 | "question": "What is known as "the brain" of the Computer?", 265 | "correct_answer": "Central Processing Unit", 266 | "incorrect_answers": ["Motherboard", "Graphics Processing Unit", "Keyboard"] 267 | }, 268 | { 269 | "id": "26", 270 | "category": "Science: Computers", 271 | "type": "multiple", 272 | "difficulty": "hard", 273 | "question": "Which data structure does FILO apply to?", 274 | "correct_answer": "Stack", 275 | "incorrect_answers": ["Queue", "Heap", "Tree"] 276 | }, 277 | { 278 | "id": "27", 279 | "category": "Science: Computers", 280 | "type": "multiple", 281 | "difficulty": "medium", 282 | "question": "What does the term GPU stand for?", 283 | "correct_answer": "Graphics Processing Unit", 284 | "incorrect_answers": [ 285 | "Gaming Processor Unit", 286 | "Graphite Producing Unit", 287 | "Graphical Proprietary Unit" 288 | ] 289 | }, 290 | { 291 | "id": "28", 292 | "category": "Science: Computers", 293 | "type": "multiple", 294 | "difficulty": "hard", 295 | "question": "What is the name of the process that sends one qubit of information using two bits of classical information?", 296 | "correct_answer": "Quantum Teleportation", 297 | "incorrect_answers": [ 298 | "Super Dense Coding", 299 | "Quantum Entanglement", 300 | "Quantum Programming" 301 | ] 302 | }, 303 | { 304 | "id": "29", 305 | "category": "Science: Computers", 306 | "type": "multiple", 307 | "difficulty": "hard", 308 | "question": "Which of these is not a key value of Agile software development?", 309 | "correct_answer": "Comprehensive documentation", 310 | "incorrect_answers": [ 311 | "Individuals and interactions", 312 | "Customer collaboration", 313 | "Responding to change" 314 | ] 315 | }, 316 | { 317 | "id": "30", 318 | "category": "Science: Computers", 319 | "type": "multiple", 320 | "difficulty": "medium", 321 | "question": "What is the main CPU is the Sega Mega Drive / Sega Genesis?", 322 | "correct_answer": "Motorola 68000", 323 | "incorrect_answers": ["Zilog Z80", "Yamaha YM2612", "Intel 8088"] 324 | }, 325 | { 326 | "id": "31", 327 | "category": "Science: Computers", 328 | "type": "multiple", 329 | "difficulty": "easy", 330 | "question": "This mobile OS held the largest market share in 2012.", 331 | "correct_answer": "iOS", 332 | "incorrect_answers": ["Android", "BlackBerry", "Symbian"] 333 | }, 334 | { 335 | "id": "32", 336 | "category": "Science: Computers", 337 | "type": "multiple", 338 | "difficulty": "medium", 339 | "question": "Which of these people was NOT a founder of Apple Inc?", 340 | "correct_answer": "Jonathan Ive", 341 | "incorrect_answers": ["Steve Jobs", "Ronald Wayne", "Steve Wozniak"] 342 | }, 343 | { 344 | "id": "33", 345 | "category": "Science: Computers", 346 | "type": "multiple", 347 | "difficulty": "hard", 348 | "question": "Which RAID array type is associated with data mirroring?", 349 | "correct_answer": "RAID 1", 350 | "incorrect_answers": ["RAID 0", "RAID 10", "RAID 5"] 351 | }, 352 | { 353 | "id": "34", 354 | "category": "Science: Computers", 355 | "type": "multiple", 356 | "difficulty": "easy", 357 | "question": "How many values can a single byte represent?", 358 | "correct_answer": "256", 359 | "incorrect_answers": ["8", "1", "1024"] 360 | }, 361 | { 362 | "id": "35", 363 | "category": "Science: Computers", 364 | "type": "multiple", 365 | "difficulty": "easy", 366 | "question": "The C programming language was created by this American computer scientist. ", 367 | "correct_answer": "Dennis Ritchie", 368 | "incorrect_answers": ["Tim Berners Lee", "al-Khwārizmī", "Willis Ware"] 369 | }, 370 | { 371 | "id": "36", 372 | "category": "Science: Computers", 373 | "type": "multiple", 374 | "difficulty": "medium", 375 | "question": "Which programming language was developed by Sun Microsystems in 1995?", 376 | "correct_answer": "Java", 377 | "incorrect_answers": ["Python", "Solaris OS", "C++"] 378 | }, 379 | { 380 | "id": "37", 381 | "category": "Science: Computers", 382 | "type": "multiple", 383 | "difficulty": "medium", 384 | "question": "The name of technology company HP stands for what?", 385 | "correct_answer": "Hewlett-Packard", 386 | "incorrect_answers": ["Howard Packmann", "Husker-Pollosk", "Hellman-Pohl"] 387 | }, 388 | { 389 | "id": "38", 390 | "category": "Science: Computers", 391 | "type": "multiple", 392 | "difficulty": "hard", 393 | "question": "Who invented the "Spanning Tree Protocol"?", 394 | "correct_answer": "Radia Perlman", 395 | "incorrect_answers": ["Paul Vixie", "Vint Cerf", "Michael Roberts"] 396 | }, 397 | { 398 | "id": "39", 399 | "category": "Science: Computers", 400 | "type": "multiple", 401 | "difficulty": "medium", 402 | "question": "In programming, what do you call functions with the same name but different implementations?", 403 | "correct_answer": "Overloading", 404 | "incorrect_answers": ["Overriding", "Abstracting", "Inheriting"] 405 | }, 406 | { 407 | "id": "40", 408 | "category": "Science: Computers", 409 | "type": "multiple", 410 | "difficulty": "medium", 411 | "question": "What does RAID stand for?", 412 | "correct_answer": "Redundant Array of Independent Disks", 413 | "incorrect_answers": [ 414 | "Rapid Access for Indexed Devices", 415 | "Range of Applications with Identical Designs", 416 | "Randomized Abstract Identification Description" 417 | ] 418 | }, 419 | { 420 | "id": "41", 421 | "category": "Science: Computers", 422 | "type": "multiple", 423 | "difficulty": "easy", 424 | "question": "How long is an IPv6 address?", 425 | "correct_answer": "128 bits", 426 | "incorrect_answers": ["32 bits", "64 bits", "128 bytes"] 427 | }, 428 | { 429 | "id": "42", 430 | "category": "Science: Computers", 431 | "type": "multiple", 432 | "difficulty": "easy", 433 | "question": "In computing, what does MIDI stand for?", 434 | "correct_answer": "Musical Instrument Digital Interface", 435 | "incorrect_answers": [ 436 | "Musical Interface of Digital Instruments", 437 | "Modular Interface of Digital Instruments", 438 | "Musical Instrument Data Interface" 439 | ] 440 | }, 441 | { 442 | "id": "43", 443 | "category": "Science: Computers", 444 | "type": "multiple", 445 | "difficulty": "easy", 446 | "question": "In computing, what does LAN stand for?", 447 | "correct_answer": "Local Area Network", 448 | "incorrect_answers": [ 449 | "Long Antenna Node", 450 | "Light Access Node", 451 | "Land Address Navigation" 452 | ] 453 | }, 454 | { 455 | "id": "44", 456 | "category": "Science: Computers", 457 | "type": "multiple", 458 | "difficulty": "medium", 459 | "question": "How many bytes are in a single Kibibyte?", 460 | "correct_answer": "1024", 461 | "incorrect_answers": ["2400", "1000", "1240"] 462 | }, 463 | { 464 | "id": "45", 465 | "category": "Science: Computers", 466 | "type": "multiple", 467 | "difficulty": "hard", 468 | "question": "According to DeMorgan's Theorem, the Boolean expression (AB)' is equivalent to:", 469 | "correct_answer": "A' + B'", 470 | "incorrect_answers": [ 471 | "A'B + B'A", 472 | "A'B'", 473 | "AB' + AB" 474 | ] 475 | }, 476 | { 477 | "id": "46", 478 | "category": "Science: Computers", 479 | "type": "multiple", 480 | "difficulty": "hard", 481 | "question": "The acronym "RIP" stands for which of these?", 482 | "correct_answer": "Routing Information Protocol", 483 | "incorrect_answers": [ 484 | "Runtime Instance Processes", 485 | "Regular Interval Processes", 486 | "Routine Inspection Protocol" 487 | ] 488 | }, 489 | { 490 | "id": "47", 491 | "category": "Science: Computers", 492 | "type": "multiple", 493 | "difficulty": "hard", 494 | "question": "Which of these is not a layer in the OSI model for data communications?", 495 | "correct_answer": "Connection Layer", 496 | "incorrect_answers": [ 497 | "Application Layer", 498 | "Transport Layer", 499 | "Physical Layer" 500 | ] 501 | }, 502 | { 503 | "id": "48", 504 | "category": "Science: Computers", 505 | "type": "multiple", 506 | "difficulty": "medium", 507 | "question": "What is the number of keys on a standard Windows Keyboard?", 508 | "correct_answer": "104", 509 | "incorrect_answers": ["64", "94", "76"] 510 | }, 511 | { 512 | "id": "49", 513 | "category": "Science: Computers", 514 | "type": "multiple", 515 | "difficulty": "easy", 516 | "question": "What does the computer software acronym JVM stand for?", 517 | "correct_answer": "Java Virtual Machine", 518 | "incorrect_answers": [ 519 | "Java Vendor Machine", 520 | "Java Visual Machine", 521 | "Just Virtual Machine" 522 | ] 523 | }, 524 | { 525 | "id": "50", 526 | "category": "Entertainment: Video Games", 527 | "type": "multiple", 528 | "difficulty": "easy", 529 | "question": "What is the name of "Team Fortress 2" update, in which it became Free-to-play?", 530 | "correct_answer": "Über Update", 531 | "incorrect_answers": [ 532 | "Pyromania Update", 533 | "Mann-Conomy Update", 534 | "Engineer Update" 535 | ] 536 | }, 537 | { 538 | "id": "51", 539 | "category": "Entertainment: Video Games", 540 | "type": "multiple", 541 | "difficulty": "medium", 542 | "question": "Who's the creator of Geometry Dash?", 543 | "correct_answer": "Robert Topala", 544 | "incorrect_answers": ["Scott Cawthon", "Adam Engels", "Andrew Spinks"] 545 | }, 546 | { 547 | "id": "52", 548 | "category": "Entertainment: Video Games", 549 | "type": "multiple", 550 | "difficulty": "easy", 551 | "question": "Who created the digital distribution platform Steam?", 552 | "correct_answer": "Valve", 553 | "incorrect_answers": ["Pixeltail Games", "Ubisoft", "Electronic Arts"] 554 | }, 555 | { 556 | "id": "53", 557 | "category": "Entertainment: Video Games", 558 | "type": "multiple", 559 | "difficulty": "easy", 560 | "question": "What year was the game Team Fortress 2 released?", 561 | "correct_answer": "2007", 562 | "incorrect_answers": ["2009", "2005", "2010"] 563 | }, 564 | { 565 | "id": "54", 566 | "category": "Entertainment: Video Games", 567 | "type": "multiple", 568 | "difficulty": "hard", 569 | "question": "What was the code name given to Sonic the Hedgehog 4 during its development?", 570 | "correct_answer": "Project Needlemouse", 571 | "incorrect_answers": [ 572 | "Project Bluespike", 573 | "Project Roboegg", 574 | "Project Darksphere" 575 | ] 576 | }, 577 | { 578 | "id": "55", 579 | "category": "Entertainment: Video Games", 580 | "type": "multiple", 581 | "difficulty": "medium", 582 | "question": "What is Solid Snake's real name?", 583 | "correct_answer": "David", 584 | "incorrect_answers": ["Solid Snake", "John", "Huey"] 585 | }, 586 | { 587 | "id": "56", 588 | "category": "Entertainment: Video Games", 589 | "type": "multiple", 590 | "difficulty": "medium", 591 | "question": "Who is the villain company in "Stardew Valley"?", 592 | "correct_answer": "Joja Co ", 593 | "incorrect_answers": ["Ronin", "Empire", "Robotnik Industry's "] 594 | }, 595 | { 596 | "id": "57", 597 | "category": "Entertainment: Video Games", 598 | "type": "multiple", 599 | "difficulty": "hard", 600 | "question": "In the original "Super Mario Bros.", what is the acceleration of Mario if he was in free fall?", 601 | "correct_answer": "91.28 m/s^2", 602 | "incorrect_answers": ["110 m/s^2", "9.42 m/s^2", "4.4 m/s^2"] 603 | }, 604 | { 605 | "id": "58", 606 | "category": "Entertainment: Video Games", 607 | "type": "multiple", 608 | "difficulty": "medium", 609 | "question": "How much does the 'AWP' cost in Counter-Strike: Global Offensive?", 610 | "correct_answer": "$4750", 611 | "incorrect_answers": ["$4500", "$4650", "$5000"] 612 | }, 613 | { 614 | "id": "59", 615 | "category": "Entertainment: Video Games", 616 | "type": "multiple", 617 | "difficulty": "medium", 618 | "question": "What was the first interactive movie video game?", 619 | "correct_answer": "Astron Belt", 620 | "incorrect_answers": ["Dragon's Lair", "Cube Quest", "M.A.C.H. 3"] 621 | }, 622 | { 623 | "id": "60", 624 | "category": "Entertainment: Video Games", 625 | "type": "multiple", 626 | "difficulty": "easy", 627 | "question": "Which of these Starbound races has a Wild West culture?", 628 | "correct_answer": "Novakid", 629 | "incorrect_answers": ["Avian", "Human", "Hylotl"] 630 | }, 631 | { 632 | "id": "61", 633 | "category": "Entertainment: Video Games", 634 | "type": "multiple", 635 | "difficulty": "medium", 636 | "question": "In Need For Speed Most Wanted (2005), what do you drive at the beginning of the career mode?", 637 | "correct_answer": "BMW M3 GTR", 638 | "incorrect_answers": ["Porsche 911 Turbo", "Nissan 240SX", "Ford Mustang"] 639 | }, 640 | { 641 | "id": "62", 642 | "category": "Entertainment: Video Games", 643 | "type": "multiple", 644 | "difficulty": "medium", 645 | "question": "What happened to Half-Life 2 prior to its release, which resulted in Valve starting over the development of the game?", 646 | "correct_answer": "The source code got leaked", 647 | "incorrect_answers": [ 648 | "They weren't satisfied with the result", 649 | "The story was not good enough", 650 | "Way too many bugs to be fixed" 651 | ] 652 | }, 653 | { 654 | "id": "63", 655 | "category": "Entertainment: Video Games", 656 | "type": "multiple", 657 | "difficulty": "easy", 658 | "question": "TF2: What code does Soldier put into the door keypad in "Meet the Spy"?", 659 | "correct_answer": "1111", 660 | "incorrect_answers": ["1432", "1337", "No code"] 661 | }, 662 | { 663 | "id": "64", 664 | "category": "Entertainment: Video Games", 665 | "type": "multiple", 666 | "difficulty": "easy", 667 | "question": "What was Frank West's job in "Dead Rising"?", 668 | "correct_answer": "Photojournalist", 669 | "incorrect_answers": ["Janitor", "Chef", "Taxi Driver"] 670 | }, 671 | { 672 | "id": "65", 673 | "category": "Entertainment: Video Games", 674 | "type": "multiple", 675 | "difficulty": "medium", 676 | "question": "In "Overwatch", what is the name of Mercy's "ultimate ability"?", 677 | "correct_answer": "Valkyrie", 678 | "incorrect_answers": ["Earthshatter", "Rocket Barrage", "Molten Core"] 679 | }, 680 | { 681 | "id": "66", 682 | "category": "Entertainment: Video Games", 683 | "type": "multiple", 684 | "difficulty": "easy", 685 | "question": "What video game sparked controversy because of its hidden "Hot Coffee" minigame?", 686 | "correct_answer": "Grand Theft Auto: San Andreas", 687 | "incorrect_answers": [ 688 | "Grand Theft Auto: Vice City", 689 | "Hitman: Blood Money", 690 | "Cooking Mama" 691 | ] 692 | }, 693 | { 694 | "id": "67", 695 | "category": "Entertainment: Video Games", 696 | "type": "multiple", 697 | "difficulty": "easy", 698 | "question": "How many flagship monsters appear in Monster Hunter Gernerations?", 699 | "correct_answer": "4", 700 | "incorrect_answers": ["1", "2", "3"] 701 | }, 702 | { 703 | "id": "68", 704 | "category": "Entertainment: Video Games", 705 | "type": "multiple", 706 | "difficulty": "hard", 707 | "question": "What's the name of the halloween-related Sims 4 Stuff Pack released September 29th, 2015?", 708 | "correct_answer": "Spooky Stuff", 709 | "incorrect_answers": [ 710 | "Ghosts n' Ghouls", 711 | "Nerving Nights", 712 | "Fearful Frights" 713 | ] 714 | }, 715 | { 716 | "id": "69", 717 | "category": "Entertainment: Video Games", 718 | "type": "multiple", 719 | "difficulty": "hard", 720 | "question": "In Xenoblade Chronicles X, which class has a sniper rifle as it's primary weapon?", 721 | "correct_answer": "Partisan Eagle", 722 | "incorrect_answers": ["Blast Fencer", "Winged Viper", "Bastion Warrior"] 723 | }, 724 | { 725 | "id": "70", 726 | "category": "Entertainment: Video Games", 727 | "type": "multiple", 728 | "difficulty": "easy", 729 | "question": "In what year was Hearthstone released?", 730 | "correct_answer": "2014", 731 | "incorrect_answers": ["2011", "2013", "2012"] 732 | }, 733 | { 734 | "id": "71", 735 | "category": "Entertainment: Video Games", 736 | "type": "multiple", 737 | "difficulty": "medium", 738 | "question": "In the game "Terraria", which of these bosses are pre-hardmode bosses?", 739 | "correct_answer": "Eye of Cthulhu", 740 | "incorrect_answers": ["Plantera", "Skeletron Prime", "The Destroyer"] 741 | }, 742 | { 743 | "id": "72", 744 | "category": "Entertainment: Video Games", 745 | "type": "multiple", 746 | "difficulty": "medium", 747 | "question": "This weapon in Counter-Strike: Global Offensive does not exist in real life.", 748 | "correct_answer": "M4A4", 749 | "incorrect_answers": ["AWP", "M4A1", "MP9"] 750 | }, 751 | { 752 | "id": "73", 753 | "category": "Entertainment: Video Games", 754 | "type": "multiple", 755 | "difficulty": "easy", 756 | "question": "In what year was the game "FTL: Faster Than Light" released?", 757 | "correct_answer": "2012", 758 | "incorrect_answers": ["2014", "2013", "2011"] 759 | }, 760 | { 761 | "id": "74", 762 | "category": "Entertainment: Video Games", 763 | "type": "multiple", 764 | "difficulty": "medium", 765 | "question": "What was the first .hack game?", 766 | "correct_answer": ".hack//Infection", 767 | "incorrect_answers": [".hack//Zero", ".hack//Sign", ".hack//Liminality"] 768 | }, 769 | { 770 | "id": "75", 771 | "category": "Entertainment: Video Games", 772 | "type": "multiple", 773 | "difficulty": "medium", 774 | "question": "In Terraria, what does the Wall of Flesh not drop upon defeat?", 775 | "correct_answer": "Picksaw", 776 | "incorrect_answers": ["Pwnhammer", "Breaker Blade", "Laser Rifle"] 777 | }, 778 | { 779 | "id": "76", 780 | "category": "Entertainment: Video Games", 781 | "type": "multiple", 782 | "difficulty": "easy", 783 | "question": ""Minecraft" was released from beta in 2011 during a convention held in which city?", 784 | "correct_answer": "Las Vegas", 785 | "incorrect_answers": ["Paris", "Bellevue", "London"] 786 | }, 787 | { 788 | "id": "77", 789 | "category": "Entertainment: Video Games", 790 | "type": "multiple", 791 | "difficulty": "medium", 792 | "question": "How many regular Sunken Sea Scrolls are there in "Splatoon"?", 793 | "correct_answer": "27", 794 | "incorrect_answers": ["32", "30", "5"] 795 | }, 796 | { 797 | "id": "78", 798 | "category": "Entertainment: Video Games", 799 | "type": "multiple", 800 | "difficulty": "medium", 801 | "question": "Danganronpa Another Episode: Ultra Despair Girls is set after which Danganronpa game?", 802 | "correct_answer": "Danganronpa: Trigger Happy Havoc", 803 | "incorrect_answers": [ 804 | "Danganronpa 2: Goodbye Despair", 805 | "Danganronpa V3: Killing Harmony", 806 | "Danganronpa 3: The End of Hope's Peak High School" 807 | ] 808 | }, 809 | { 810 | "id": "79", 811 | "category": "Entertainment: Video Games", 812 | "type": "multiple", 813 | "difficulty": "medium", 814 | "question": "What is not a playable race in "Final Fantasy XIV: A Realm Reborn"?", 815 | "correct_answer": "Hume", 816 | "incorrect_answers": ["Miqo'te", "Lalafell", "Roegadyn"] 817 | }, 818 | { 819 | "id": "80", 820 | "category": "Entertainment: Video Games", 821 | "type": "multiple", 822 | "difficulty": "hard", 823 | "question": "Which game in the "Dark Souls" series does the player play as the "Ashen One"?", 824 | "correct_answer": "Dark Souls III", 825 | "incorrect_answers": ["Dark Souls I", "Bloodborne", "Demon Souls"] 826 | }, 827 | { 828 | "id": "81", 829 | "category": "Entertainment: Video Games", 830 | "type": "multiple", 831 | "difficulty": "medium", 832 | "question": "What is the name of the first level in "Call of Duty: World at War"?", 833 | "correct_answer": "Semper Fi", 834 | "incorrect_answers": ["Ring of Steel", "Vendetta", "Eviction"] 835 | }, 836 | { 837 | "id": "82", 838 | "category": "Entertainment: Video Games", 839 | "type": "multiple", 840 | "difficulty": "medium", 841 | "question": "In the "Call Of Duty: Zombies" map "Moon", there is a secondary called the QED. What does QED stand for?", 842 | "correct_answer": "Quantum Entanglement Device", 843 | "incorrect_answers": [ 844 | "Quad Ectoplasmic Driver", 845 | "Question Every Dog", 846 | "Quality Edward Device" 847 | ] 848 | }, 849 | { 850 | "id": "83", 851 | "category": "Entertainment: Video Games", 852 | "type": "multiple", 853 | "difficulty": "easy", 854 | "question": "In "Call Of Duty: Zombies", what is the name of the Pack-A-Punched Crossbow?", 855 | "correct_answer": "Awful Lawton", 856 | "incorrect_answers": ["Longinus", "V-R11", "Predator"] 857 | }, 858 | { 859 | "id": "84", 860 | "category": "Entertainment: Video Games", 861 | "type": "multiple", 862 | "difficulty": "medium", 863 | "question": "In "Call Of Duty: Zombies", completing which map's main easter egg will reward you with the achievement, "Little Lost Girl"?", 864 | "correct_answer": "Origins", 865 | "incorrect_answers": ["Revelations", "Moon", "Tranzit"] 866 | }, 867 | { 868 | "id": "85", 869 | "category": "Entertainment: Video Games", 870 | "type": "multiple", 871 | "difficulty": "medium", 872 | "question": "Which company developed and published Game Dev Tycoon?", 873 | "correct_answer": "Greenheart Games", 874 | "incorrect_answers": ["Greenland Games", "The Tycoonists", "MomCorp"] 875 | }, 876 | { 877 | "id": "86", 878 | "category": "Entertainment: Video Games", 879 | "type": "multiple", 880 | "difficulty": "hard", 881 | "question": "Which of these characters wasn't a villian in Club Penguin?", 882 | "correct_answer": "The Director", 883 | "incorrect_answers": ["Herbert P. Bear", "Tusk", "Ultimate Proto-Bot 10000"] 884 | }, 885 | { 886 | "id": "87", 887 | "category": "Entertainment: Video Games", 888 | "type": "multiple", 889 | "difficulty": "easy", 890 | "question": "In which mall does "Dead Rising" take place?", 891 | "correct_answer": "Willamette Parkview Mall", 892 | "incorrect_answers": [ 893 | "Liberty Mall", 894 | "Twin Pines Mall", 895 | "Central Square Shopping Center" 896 | ] 897 | }, 898 | { 899 | "id": "88", 900 | "category": "Entertainment: Video Games", 901 | "type": "multiple", 902 | "difficulty": "medium", 903 | "question": "In what year was Pokémon Diamond & Pearl released in Japan?", 904 | "correct_answer": "2006", 905 | "incorrect_answers": ["2009", "2007", "2008"] 906 | }, 907 | { 908 | "id": "89", 909 | "category": "Entertainment: Video Games", 910 | "type": "multiple", 911 | "difficulty": "medium", 912 | "question": "Which of these is NOT a name of a city in the main island of PLAYERUNKNOWN'S BATTLEGROUNDS?", 913 | "correct_answer": "Belushya Guba", 914 | "incorrect_answers": ["Yasnaya Polyana", "Pochinki", "Georgopol"] 915 | }, 916 | { 917 | "id": "90", 918 | "category": "Entertainment: Video Games", 919 | "type": "multiple", 920 | "difficulty": "medium", 921 | "question": "In Telltale Games' "The Walking Dead: Season One" what is the name of Clementine's father?", 922 | "correct_answer": "Ed", 923 | "incorrect_answers": ["Charles", "Lee", "Walter"] 924 | }, 925 | { 926 | "id": "91", 927 | "category": "Entertainment: Video Games", 928 | "type": "multiple", 929 | "difficulty": "medium", 930 | "question": "How many controllers could a Nintendo GameCube have plugged in at one time?", 931 | "correct_answer": "4", 932 | "incorrect_answers": ["8", "6", "2"] 933 | }, 934 | { 935 | "id": "92", 936 | "category": "Entertainment: Video Games", 937 | "type": "multiple", 938 | "difficulty": "medium", 939 | "question": "Which Crypt of the NecroDancer (2015) character has a soundtrack by Jake "Virt" Kaufman?", 940 | "correct_answer": "Uncle Eli", 941 | "incorrect_answers": ["Cadence", "Nocturna", "Octavian (Bard)"] 942 | }, 943 | { 944 | "id": "93", 945 | "category": "Entertainment: Video Games", 946 | "type": "multiple", 947 | "difficulty": "medium", 948 | "question": "What is the only Generation III Pokemon whose name begins with the letter I?", 949 | "correct_answer": "Illumise", 950 | "incorrect_answers": ["Infernape", "Ivysaur", "Igglybuff"] 951 | }, 952 | { 953 | "id": "94", 954 | "category": "Entertainment: Video Games", 955 | "type": "multiple", 956 | "difficulty": "hard", 957 | "question": "In World of Warcraft, which raid instance features a chess event?", 958 | "correct_answer": "Karazhan", 959 | "incorrect_answers": [ 960 | "Zul'Aman", 961 | "Blackwing Lair", 962 | "Temple of Ahn'Qiraj" 963 | ] 964 | }, 965 | { 966 | "id": "95", 967 | "category": "Entertainment: Video Games", 968 | "type": "multiple", 969 | "difficulty": "medium", 970 | "question": "In the 1980s, a service called Gameline allowed users to download games to what console?", 971 | "correct_answer": "Atari 2600", 972 | "incorrect_answers": [ 973 | "Sega Genesis", 974 | "Nintendo Entertainment System", 975 | "ColecoVision" 976 | ] 977 | }, 978 | { 979 | "id": "96", 980 | "category": "Entertainment: Video Games", 981 | "type": "multiple", 982 | "difficulty": "medium", 983 | "question": "What is the subtitle for Gran Turismo 3?", 984 | "correct_answer": "A-Spec", 985 | "incorrect_answers": ["Championship", "Drive", "Nitro"] 986 | }, 987 | { 988 | "id": "97", 989 | "category": "Entertainment: Video Games", 990 | "type": "multiple", 991 | "difficulty": "medium", 992 | "question": "Who is credited with having created the world's first video game Easter Egg?", 993 | "correct_answer": "Warren Robinett", 994 | "incorrect_answers": ["Julius Smith", "Will Crowther", "Don Woods"] 995 | }, 996 | { 997 | "id": "98", 998 | "category": "Entertainment: Video Games", 999 | "type": "multiple", 1000 | "difficulty": "medium", 1001 | "question": "What character is NOT apart of the Grand Theft Auto series?", 1002 | "correct_answer": "Michael Cardenas", 1003 | "incorrect_answers": ["Packie McReary", "Tommy Vercetti", "Lester Crest"] 1004 | }, 1005 | { 1006 | "id": "99", 1007 | "category": "Entertainment: Video Games", 1008 | "type": "multiple", 1009 | "difficulty": "medium", 1010 | "question": "Which of the following characters is NOT playable in "Resident Evil 6"?", 1011 | "correct_answer": "Jill Valentine", 1012 | "incorrect_answers": ["Chris Redfield", "Sherry Birkin", "Helena Harper"] 1013 | } 1014 | ] 1015 | -------------------------------------------------------------------------------- /api/graphql.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "__schema": { 3 | "queryType": { 4 | "name": "Query" 5 | }, 6 | "mutationType": { 7 | "name": "Mutation" 8 | }, 9 | "subscriptionType": null, 10 | "types": [ 11 | { 12 | "kind": "OBJECT", 13 | "name": "Query", 14 | "description": null, 15 | "fields": [ 16 | { 17 | "name": "question", 18 | "description": null, 19 | "args": [ 20 | { 21 | "name": "id", 22 | "description": null, 23 | "type": { 24 | "kind": "NON_NULL", 25 | "name": null, 26 | "ofType": { 27 | "kind": "SCALAR", 28 | "name": "ID", 29 | "ofType": null 30 | } 31 | }, 32 | "defaultValue": null 33 | } 34 | ], 35 | "type": { 36 | "kind": "OBJECT", 37 | "name": "Question", 38 | "ofType": null 39 | }, 40 | "isDeprecated": false, 41 | "deprecationReason": null 42 | }, 43 | { 44 | "name": "getRandomQuestion", 45 | "description": null, 46 | "args": [], 47 | "type": { 48 | "kind": "OBJECT", 49 | "name": "Question", 50 | "ofType": null 51 | }, 52 | "isDeprecated": false, 53 | "deprecationReason": null 54 | } 55 | ], 56 | "inputFields": null, 57 | "interfaces": [], 58 | "enumValues": null, 59 | "possibleTypes": null 60 | }, 61 | { 62 | "kind": "SCALAR", 63 | "name": "ID", 64 | "description": "The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `\"4\"`) or integer (such as `4`) input value will be accepted as an ID.", 65 | "fields": null, 66 | "inputFields": null, 67 | "interfaces": null, 68 | "enumValues": null, 69 | "possibleTypes": null 70 | }, 71 | { 72 | "kind": "OBJECT", 73 | "name": "Question", 74 | "description": null, 75 | "fields": [ 76 | { 77 | "name": "id", 78 | "description": null, 79 | "args": [], 80 | "type": { 81 | "kind": "NON_NULL", 82 | "name": null, 83 | "ofType": { 84 | "kind": "SCALAR", 85 | "name": "ID", 86 | "ofType": null 87 | } 88 | }, 89 | "isDeprecated": false, 90 | "deprecationReason": null 91 | }, 92 | { 93 | "name": "question", 94 | "description": null, 95 | "args": [], 96 | "type": { 97 | "kind": "NON_NULL", 98 | "name": null, 99 | "ofType": { 100 | "kind": "SCALAR", 101 | "name": "String", 102 | "ofType": null 103 | } 104 | }, 105 | "isDeprecated": false, 106 | "deprecationReason": null 107 | }, 108 | { 109 | "name": "correctAnswer", 110 | "description": null, 111 | "args": [], 112 | "type": { 113 | "kind": "NON_NULL", 114 | "name": null, 115 | "ofType": { 116 | "kind": "SCALAR", 117 | "name": "String", 118 | "ofType": null 119 | } 120 | }, 121 | "isDeprecated": false, 122 | "deprecationReason": null 123 | }, 124 | { 125 | "name": "answers", 126 | "description": null, 127 | "args": [], 128 | "type": { 129 | "kind": "NON_NULL", 130 | "name": null, 131 | "ofType": { 132 | "kind": "LIST", 133 | "name": null, 134 | "ofType": { 135 | "kind": "NON_NULL", 136 | "name": null, 137 | "ofType": { 138 | "kind": "SCALAR", 139 | "name": "String", 140 | "ofType": null 141 | } 142 | } 143 | } 144 | }, 145 | "isDeprecated": false, 146 | "deprecationReason": null 147 | } 148 | ], 149 | "inputFields": null, 150 | "interfaces": [], 151 | "enumValues": null, 152 | "possibleTypes": null 153 | }, 154 | { 155 | "kind": "SCALAR", 156 | "name": "String", 157 | "description": "The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.", 158 | "fields": null, 159 | "inputFields": null, 160 | "interfaces": null, 161 | "enumValues": null, 162 | "possibleTypes": null 163 | }, 164 | { 165 | "kind": "OBJECT", 166 | "name": "Mutation", 167 | "description": null, 168 | "fields": [ 169 | { 170 | "name": "answerQuestion", 171 | "description": null, 172 | "args": [ 173 | { 174 | "name": "id", 175 | "description": null, 176 | "type": { 177 | "kind": "SCALAR", 178 | "name": "ID", 179 | "ofType": null 180 | }, 181 | "defaultValue": null 182 | }, 183 | { 184 | "name": "answer", 185 | "description": null, 186 | "type": { 187 | "kind": "SCALAR", 188 | "name": "String", 189 | "ofType": null 190 | }, 191 | "defaultValue": null 192 | } 193 | ], 194 | "type": { 195 | "kind": "OBJECT", 196 | "name": "Answer", 197 | "ofType": null 198 | }, 199 | "isDeprecated": false, 200 | "deprecationReason": null 201 | } 202 | ], 203 | "inputFields": null, 204 | "interfaces": [], 205 | "enumValues": null, 206 | "possibleTypes": null 207 | }, 208 | { 209 | "kind": "OBJECT", 210 | "name": "Answer", 211 | "description": null, 212 | "fields": [ 213 | { 214 | "name": "questionId", 215 | "description": null, 216 | "args": [], 217 | "type": { 218 | "kind": "SCALAR", 219 | "name": "ID", 220 | "ofType": null 221 | }, 222 | "isDeprecated": false, 223 | "deprecationReason": null 224 | }, 225 | { 226 | "name": "question", 227 | "description": null, 228 | "args": [], 229 | "type": { 230 | "kind": "NON_NULL", 231 | "name": null, 232 | "ofType": { 233 | "kind": "SCALAR", 234 | "name": "String", 235 | "ofType": null 236 | } 237 | }, 238 | "isDeprecated": false, 239 | "deprecationReason": null 240 | }, 241 | { 242 | "name": "submittedAnswer", 243 | "description": null, 244 | "args": [], 245 | "type": { 246 | "kind": "NON_NULL", 247 | "name": null, 248 | "ofType": { 249 | "kind": "SCALAR", 250 | "name": "String", 251 | "ofType": null 252 | } 253 | }, 254 | "isDeprecated": false, 255 | "deprecationReason": null 256 | }, 257 | { 258 | "name": "correctAnswer", 259 | "description": null, 260 | "args": [], 261 | "type": { 262 | "kind": "NON_NULL", 263 | "name": null, 264 | "ofType": { 265 | "kind": "SCALAR", 266 | "name": "String", 267 | "ofType": null 268 | } 269 | }, 270 | "isDeprecated": false, 271 | "deprecationReason": null 272 | }, 273 | { 274 | "name": "correct", 275 | "description": null, 276 | "args": [], 277 | "type": { 278 | "kind": "SCALAR", 279 | "name": "Boolean", 280 | "ofType": null 281 | }, 282 | "isDeprecated": false, 283 | "deprecationReason": null 284 | } 285 | ], 286 | "inputFields": null, 287 | "interfaces": [], 288 | "enumValues": null, 289 | "possibleTypes": null 290 | }, 291 | { 292 | "kind": "SCALAR", 293 | "name": "Boolean", 294 | "description": "The `Boolean` scalar type represents `true` or `false`.", 295 | "fields": null, 296 | "inputFields": null, 297 | "interfaces": null, 298 | "enumValues": null, 299 | "possibleTypes": null 300 | }, 301 | { 302 | "kind": "OBJECT", 303 | "name": "__Schema", 304 | "description": "A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.", 305 | "fields": [ 306 | { 307 | "name": "types", 308 | "description": "A list of all types supported by this server.", 309 | "args": [], 310 | "type": { 311 | "kind": "NON_NULL", 312 | "name": null, 313 | "ofType": { 314 | "kind": "LIST", 315 | "name": null, 316 | "ofType": { 317 | "kind": "NON_NULL", 318 | "name": null, 319 | "ofType": { 320 | "kind": "OBJECT", 321 | "name": "__Type", 322 | "ofType": null 323 | } 324 | } 325 | } 326 | }, 327 | "isDeprecated": false, 328 | "deprecationReason": null 329 | }, 330 | { 331 | "name": "queryType", 332 | "description": "The type that query operations will be rooted at.", 333 | "args": [], 334 | "type": { 335 | "kind": "NON_NULL", 336 | "name": null, 337 | "ofType": { 338 | "kind": "OBJECT", 339 | "name": "__Type", 340 | "ofType": null 341 | } 342 | }, 343 | "isDeprecated": false, 344 | "deprecationReason": null 345 | }, 346 | { 347 | "name": "mutationType", 348 | "description": "If this server supports mutation, the type that mutation operations will be rooted at.", 349 | "args": [], 350 | "type": { 351 | "kind": "OBJECT", 352 | "name": "__Type", 353 | "ofType": null 354 | }, 355 | "isDeprecated": false, 356 | "deprecationReason": null 357 | }, 358 | { 359 | "name": "subscriptionType", 360 | "description": "If this server support subscription, the type that subscription operations will be rooted at.", 361 | "args": [], 362 | "type": { 363 | "kind": "OBJECT", 364 | "name": "__Type", 365 | "ofType": null 366 | }, 367 | "isDeprecated": false, 368 | "deprecationReason": null 369 | }, 370 | { 371 | "name": "directives", 372 | "description": "A list of all directives supported by this server.", 373 | "args": [], 374 | "type": { 375 | "kind": "NON_NULL", 376 | "name": null, 377 | "ofType": { 378 | "kind": "LIST", 379 | "name": null, 380 | "ofType": { 381 | "kind": "NON_NULL", 382 | "name": null, 383 | "ofType": { 384 | "kind": "OBJECT", 385 | "name": "__Directive", 386 | "ofType": null 387 | } 388 | } 389 | } 390 | }, 391 | "isDeprecated": false, 392 | "deprecationReason": null 393 | } 394 | ], 395 | "inputFields": null, 396 | "interfaces": [], 397 | "enumValues": null, 398 | "possibleTypes": null 399 | }, 400 | { 401 | "kind": "OBJECT", 402 | "name": "__Type", 403 | "description": "The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name and description, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.", 404 | "fields": [ 405 | { 406 | "name": "kind", 407 | "description": null, 408 | "args": [], 409 | "type": { 410 | "kind": "NON_NULL", 411 | "name": null, 412 | "ofType": { 413 | "kind": "ENUM", 414 | "name": "__TypeKind", 415 | "ofType": null 416 | } 417 | }, 418 | "isDeprecated": false, 419 | "deprecationReason": null 420 | }, 421 | { 422 | "name": "name", 423 | "description": null, 424 | "args": [], 425 | "type": { 426 | "kind": "SCALAR", 427 | "name": "String", 428 | "ofType": null 429 | }, 430 | "isDeprecated": false, 431 | "deprecationReason": null 432 | }, 433 | { 434 | "name": "description", 435 | "description": null, 436 | "args": [], 437 | "type": { 438 | "kind": "SCALAR", 439 | "name": "String", 440 | "ofType": null 441 | }, 442 | "isDeprecated": false, 443 | "deprecationReason": null 444 | }, 445 | { 446 | "name": "fields", 447 | "description": null, 448 | "args": [ 449 | { 450 | "name": "includeDeprecated", 451 | "description": null, 452 | "type": { 453 | "kind": "SCALAR", 454 | "name": "Boolean", 455 | "ofType": null 456 | }, 457 | "defaultValue": "false" 458 | } 459 | ], 460 | "type": { 461 | "kind": "LIST", 462 | "name": null, 463 | "ofType": { 464 | "kind": "NON_NULL", 465 | "name": null, 466 | "ofType": { 467 | "kind": "OBJECT", 468 | "name": "__Field", 469 | "ofType": null 470 | } 471 | } 472 | }, 473 | "isDeprecated": false, 474 | "deprecationReason": null 475 | }, 476 | { 477 | "name": "interfaces", 478 | "description": null, 479 | "args": [], 480 | "type": { 481 | "kind": "LIST", 482 | "name": null, 483 | "ofType": { 484 | "kind": "NON_NULL", 485 | "name": null, 486 | "ofType": { 487 | "kind": "OBJECT", 488 | "name": "__Type", 489 | "ofType": null 490 | } 491 | } 492 | }, 493 | "isDeprecated": false, 494 | "deprecationReason": null 495 | }, 496 | { 497 | "name": "possibleTypes", 498 | "description": null, 499 | "args": [], 500 | "type": { 501 | "kind": "LIST", 502 | "name": null, 503 | "ofType": { 504 | "kind": "NON_NULL", 505 | "name": null, 506 | "ofType": { 507 | "kind": "OBJECT", 508 | "name": "__Type", 509 | "ofType": null 510 | } 511 | } 512 | }, 513 | "isDeprecated": false, 514 | "deprecationReason": null 515 | }, 516 | { 517 | "name": "enumValues", 518 | "description": null, 519 | "args": [ 520 | { 521 | "name": "includeDeprecated", 522 | "description": null, 523 | "type": { 524 | "kind": "SCALAR", 525 | "name": "Boolean", 526 | "ofType": null 527 | }, 528 | "defaultValue": "false" 529 | } 530 | ], 531 | "type": { 532 | "kind": "LIST", 533 | "name": null, 534 | "ofType": { 535 | "kind": "NON_NULL", 536 | "name": null, 537 | "ofType": { 538 | "kind": "OBJECT", 539 | "name": "__EnumValue", 540 | "ofType": null 541 | } 542 | } 543 | }, 544 | "isDeprecated": false, 545 | "deprecationReason": null 546 | }, 547 | { 548 | "name": "inputFields", 549 | "description": null, 550 | "args": [], 551 | "type": { 552 | "kind": "LIST", 553 | "name": null, 554 | "ofType": { 555 | "kind": "NON_NULL", 556 | "name": null, 557 | "ofType": { 558 | "kind": "OBJECT", 559 | "name": "__InputValue", 560 | "ofType": null 561 | } 562 | } 563 | }, 564 | "isDeprecated": false, 565 | "deprecationReason": null 566 | }, 567 | { 568 | "name": "ofType", 569 | "description": null, 570 | "args": [], 571 | "type": { 572 | "kind": "OBJECT", 573 | "name": "__Type", 574 | "ofType": null 575 | }, 576 | "isDeprecated": false, 577 | "deprecationReason": null 578 | } 579 | ], 580 | "inputFields": null, 581 | "interfaces": [], 582 | "enumValues": null, 583 | "possibleTypes": null 584 | }, 585 | { 586 | "kind": "ENUM", 587 | "name": "__TypeKind", 588 | "description": "An enum describing what kind of type a given `__Type` is.", 589 | "fields": null, 590 | "inputFields": null, 591 | "interfaces": null, 592 | "enumValues": [ 593 | { 594 | "name": "SCALAR", 595 | "description": "Indicates this type is a scalar.", 596 | "isDeprecated": false, 597 | "deprecationReason": null 598 | }, 599 | { 600 | "name": "OBJECT", 601 | "description": "Indicates this type is an object. `fields` and `interfaces` are valid fields.", 602 | "isDeprecated": false, 603 | "deprecationReason": null 604 | }, 605 | { 606 | "name": "INTERFACE", 607 | "description": "Indicates this type is an interface. `fields` and `possibleTypes` are valid fields.", 608 | "isDeprecated": false, 609 | "deprecationReason": null 610 | }, 611 | { 612 | "name": "UNION", 613 | "description": "Indicates this type is a union. `possibleTypes` is a valid field.", 614 | "isDeprecated": false, 615 | "deprecationReason": null 616 | }, 617 | { 618 | "name": "ENUM", 619 | "description": "Indicates this type is an enum. `enumValues` is a valid field.", 620 | "isDeprecated": false, 621 | "deprecationReason": null 622 | }, 623 | { 624 | "name": "INPUT_OBJECT", 625 | "description": "Indicates this type is an input object. `inputFields` is a valid field.", 626 | "isDeprecated": false, 627 | "deprecationReason": null 628 | }, 629 | { 630 | "name": "LIST", 631 | "description": "Indicates this type is a list. `ofType` is a valid field.", 632 | "isDeprecated": false, 633 | "deprecationReason": null 634 | }, 635 | { 636 | "name": "NON_NULL", 637 | "description": "Indicates this type is a non-null. `ofType` is a valid field.", 638 | "isDeprecated": false, 639 | "deprecationReason": null 640 | } 641 | ], 642 | "possibleTypes": null 643 | }, 644 | { 645 | "kind": "OBJECT", 646 | "name": "__Field", 647 | "description": "Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.", 648 | "fields": [ 649 | { 650 | "name": "name", 651 | "description": null, 652 | "args": [], 653 | "type": { 654 | "kind": "NON_NULL", 655 | "name": null, 656 | "ofType": { 657 | "kind": "SCALAR", 658 | "name": "String", 659 | "ofType": null 660 | } 661 | }, 662 | "isDeprecated": false, 663 | "deprecationReason": null 664 | }, 665 | { 666 | "name": "description", 667 | "description": null, 668 | "args": [], 669 | "type": { 670 | "kind": "SCALAR", 671 | "name": "String", 672 | "ofType": null 673 | }, 674 | "isDeprecated": false, 675 | "deprecationReason": null 676 | }, 677 | { 678 | "name": "args", 679 | "description": null, 680 | "args": [], 681 | "type": { 682 | "kind": "NON_NULL", 683 | "name": null, 684 | "ofType": { 685 | "kind": "LIST", 686 | "name": null, 687 | "ofType": { 688 | "kind": "NON_NULL", 689 | "name": null, 690 | "ofType": { 691 | "kind": "OBJECT", 692 | "name": "__InputValue", 693 | "ofType": null 694 | } 695 | } 696 | } 697 | }, 698 | "isDeprecated": false, 699 | "deprecationReason": null 700 | }, 701 | { 702 | "name": "type", 703 | "description": null, 704 | "args": [], 705 | "type": { 706 | "kind": "NON_NULL", 707 | "name": null, 708 | "ofType": { 709 | "kind": "OBJECT", 710 | "name": "__Type", 711 | "ofType": null 712 | } 713 | }, 714 | "isDeprecated": false, 715 | "deprecationReason": null 716 | }, 717 | { 718 | "name": "isDeprecated", 719 | "description": null, 720 | "args": [], 721 | "type": { 722 | "kind": "NON_NULL", 723 | "name": null, 724 | "ofType": { 725 | "kind": "SCALAR", 726 | "name": "Boolean", 727 | "ofType": null 728 | } 729 | }, 730 | "isDeprecated": false, 731 | "deprecationReason": null 732 | }, 733 | { 734 | "name": "deprecationReason", 735 | "description": null, 736 | "args": [], 737 | "type": { 738 | "kind": "SCALAR", 739 | "name": "String", 740 | "ofType": null 741 | }, 742 | "isDeprecated": false, 743 | "deprecationReason": null 744 | } 745 | ], 746 | "inputFields": null, 747 | "interfaces": [], 748 | "enumValues": null, 749 | "possibleTypes": null 750 | }, 751 | { 752 | "kind": "OBJECT", 753 | "name": "__InputValue", 754 | "description": "Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.", 755 | "fields": [ 756 | { 757 | "name": "name", 758 | "description": null, 759 | "args": [], 760 | "type": { 761 | "kind": "NON_NULL", 762 | "name": null, 763 | "ofType": { 764 | "kind": "SCALAR", 765 | "name": "String", 766 | "ofType": null 767 | } 768 | }, 769 | "isDeprecated": false, 770 | "deprecationReason": null 771 | }, 772 | { 773 | "name": "description", 774 | "description": null, 775 | "args": [], 776 | "type": { 777 | "kind": "SCALAR", 778 | "name": "String", 779 | "ofType": null 780 | }, 781 | "isDeprecated": false, 782 | "deprecationReason": null 783 | }, 784 | { 785 | "name": "type", 786 | "description": null, 787 | "args": [], 788 | "type": { 789 | "kind": "NON_NULL", 790 | "name": null, 791 | "ofType": { 792 | "kind": "OBJECT", 793 | "name": "__Type", 794 | "ofType": null 795 | } 796 | }, 797 | "isDeprecated": false, 798 | "deprecationReason": null 799 | }, 800 | { 801 | "name": "defaultValue", 802 | "description": "A GraphQL-formatted string representing the default value for this input value.", 803 | "args": [], 804 | "type": { 805 | "kind": "SCALAR", 806 | "name": "String", 807 | "ofType": null 808 | }, 809 | "isDeprecated": false, 810 | "deprecationReason": null 811 | } 812 | ], 813 | "inputFields": null, 814 | "interfaces": [], 815 | "enumValues": null, 816 | "possibleTypes": null 817 | }, 818 | { 819 | "kind": "OBJECT", 820 | "name": "__EnumValue", 821 | "description": "One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.", 822 | "fields": [ 823 | { 824 | "name": "name", 825 | "description": null, 826 | "args": [], 827 | "type": { 828 | "kind": "NON_NULL", 829 | "name": null, 830 | "ofType": { 831 | "kind": "SCALAR", 832 | "name": "String", 833 | "ofType": null 834 | } 835 | }, 836 | "isDeprecated": false, 837 | "deprecationReason": null 838 | }, 839 | { 840 | "name": "description", 841 | "description": null, 842 | "args": [], 843 | "type": { 844 | "kind": "SCALAR", 845 | "name": "String", 846 | "ofType": null 847 | }, 848 | "isDeprecated": false, 849 | "deprecationReason": null 850 | }, 851 | { 852 | "name": "isDeprecated", 853 | "description": null, 854 | "args": [], 855 | "type": { 856 | "kind": "NON_NULL", 857 | "name": null, 858 | "ofType": { 859 | "kind": "SCALAR", 860 | "name": "Boolean", 861 | "ofType": null 862 | } 863 | }, 864 | "isDeprecated": false, 865 | "deprecationReason": null 866 | }, 867 | { 868 | "name": "deprecationReason", 869 | "description": null, 870 | "args": [], 871 | "type": { 872 | "kind": "SCALAR", 873 | "name": "String", 874 | "ofType": null 875 | }, 876 | "isDeprecated": false, 877 | "deprecationReason": null 878 | } 879 | ], 880 | "inputFields": null, 881 | "interfaces": [], 882 | "enumValues": null, 883 | "possibleTypes": null 884 | }, 885 | { 886 | "kind": "OBJECT", 887 | "name": "__Directive", 888 | "description": "A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.\n\nIn some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.", 889 | "fields": [ 890 | { 891 | "name": "name", 892 | "description": null, 893 | "args": [], 894 | "type": { 895 | "kind": "NON_NULL", 896 | "name": null, 897 | "ofType": { 898 | "kind": "SCALAR", 899 | "name": "String", 900 | "ofType": null 901 | } 902 | }, 903 | "isDeprecated": false, 904 | "deprecationReason": null 905 | }, 906 | { 907 | "name": "description", 908 | "description": null, 909 | "args": [], 910 | "type": { 911 | "kind": "SCALAR", 912 | "name": "String", 913 | "ofType": null 914 | }, 915 | "isDeprecated": false, 916 | "deprecationReason": null 917 | }, 918 | { 919 | "name": "locations", 920 | "description": null, 921 | "args": [], 922 | "type": { 923 | "kind": "NON_NULL", 924 | "name": null, 925 | "ofType": { 926 | "kind": "LIST", 927 | "name": null, 928 | "ofType": { 929 | "kind": "NON_NULL", 930 | "name": null, 931 | "ofType": { 932 | "kind": "ENUM", 933 | "name": "__DirectiveLocation", 934 | "ofType": null 935 | } 936 | } 937 | } 938 | }, 939 | "isDeprecated": false, 940 | "deprecationReason": null 941 | }, 942 | { 943 | "name": "args", 944 | "description": null, 945 | "args": [], 946 | "type": { 947 | "kind": "NON_NULL", 948 | "name": null, 949 | "ofType": { 950 | "kind": "LIST", 951 | "name": null, 952 | "ofType": { 953 | "kind": "NON_NULL", 954 | "name": null, 955 | "ofType": { 956 | "kind": "OBJECT", 957 | "name": "__InputValue", 958 | "ofType": null 959 | } 960 | } 961 | } 962 | }, 963 | "isDeprecated": false, 964 | "deprecationReason": null 965 | } 966 | ], 967 | "inputFields": null, 968 | "interfaces": [], 969 | "enumValues": null, 970 | "possibleTypes": null 971 | }, 972 | { 973 | "kind": "ENUM", 974 | "name": "__DirectiveLocation", 975 | "description": "A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.", 976 | "fields": null, 977 | "inputFields": null, 978 | "interfaces": null, 979 | "enumValues": [ 980 | { 981 | "name": "QUERY", 982 | "description": "Location adjacent to a query operation.", 983 | "isDeprecated": false, 984 | "deprecationReason": null 985 | }, 986 | { 987 | "name": "MUTATION", 988 | "description": "Location adjacent to a mutation operation.", 989 | "isDeprecated": false, 990 | "deprecationReason": null 991 | }, 992 | { 993 | "name": "SUBSCRIPTION", 994 | "description": "Location adjacent to a subscription operation.", 995 | "isDeprecated": false, 996 | "deprecationReason": null 997 | }, 998 | { 999 | "name": "FIELD", 1000 | "description": "Location adjacent to a field.", 1001 | "isDeprecated": false, 1002 | "deprecationReason": null 1003 | }, 1004 | { 1005 | "name": "FRAGMENT_DEFINITION", 1006 | "description": "Location adjacent to a fragment definition.", 1007 | "isDeprecated": false, 1008 | "deprecationReason": null 1009 | }, 1010 | { 1011 | "name": "FRAGMENT_SPREAD", 1012 | "description": "Location adjacent to a fragment spread.", 1013 | "isDeprecated": false, 1014 | "deprecationReason": null 1015 | }, 1016 | { 1017 | "name": "INLINE_FRAGMENT", 1018 | "description": "Location adjacent to an inline fragment.", 1019 | "isDeprecated": false, 1020 | "deprecationReason": null 1021 | }, 1022 | { 1023 | "name": "VARIABLE_DEFINITION", 1024 | "description": "Location adjacent to a variable definition.", 1025 | "isDeprecated": false, 1026 | "deprecationReason": null 1027 | }, 1028 | { 1029 | "name": "SCHEMA", 1030 | "description": "Location adjacent to a schema definition.", 1031 | "isDeprecated": false, 1032 | "deprecationReason": null 1033 | }, 1034 | { 1035 | "name": "SCALAR", 1036 | "description": "Location adjacent to a scalar definition.", 1037 | "isDeprecated": false, 1038 | "deprecationReason": null 1039 | }, 1040 | { 1041 | "name": "OBJECT", 1042 | "description": "Location adjacent to an object type definition.", 1043 | "isDeprecated": false, 1044 | "deprecationReason": null 1045 | }, 1046 | { 1047 | "name": "FIELD_DEFINITION", 1048 | "description": "Location adjacent to a field definition.", 1049 | "isDeprecated": false, 1050 | "deprecationReason": null 1051 | }, 1052 | { 1053 | "name": "ARGUMENT_DEFINITION", 1054 | "description": "Location adjacent to an argument definition.", 1055 | "isDeprecated": false, 1056 | "deprecationReason": null 1057 | }, 1058 | { 1059 | "name": "INTERFACE", 1060 | "description": "Location adjacent to an interface definition.", 1061 | "isDeprecated": false, 1062 | "deprecationReason": null 1063 | }, 1064 | { 1065 | "name": "UNION", 1066 | "description": "Location adjacent to a union definition.", 1067 | "isDeprecated": false, 1068 | "deprecationReason": null 1069 | }, 1070 | { 1071 | "name": "ENUM", 1072 | "description": "Location adjacent to an enum definition.", 1073 | "isDeprecated": false, 1074 | "deprecationReason": null 1075 | }, 1076 | { 1077 | "name": "ENUM_VALUE", 1078 | "description": "Location adjacent to an enum value definition.", 1079 | "isDeprecated": false, 1080 | "deprecationReason": null 1081 | }, 1082 | { 1083 | "name": "INPUT_OBJECT", 1084 | "description": "Location adjacent to an input object type definition.", 1085 | "isDeprecated": false, 1086 | "deprecationReason": null 1087 | }, 1088 | { 1089 | "name": "INPUT_FIELD_DEFINITION", 1090 | "description": "Location adjacent to an input object field definition.", 1091 | "isDeprecated": false, 1092 | "deprecationReason": null 1093 | } 1094 | ], 1095 | "possibleTypes": null 1096 | } 1097 | ], 1098 | "directives": [ 1099 | { 1100 | "name": "skip", 1101 | "description": "Directs the executor to skip this field or fragment when the `if` argument is true.", 1102 | "locations": [ 1103 | "FIELD", 1104 | "FRAGMENT_SPREAD", 1105 | "INLINE_FRAGMENT" 1106 | ], 1107 | "args": [ 1108 | { 1109 | "name": "if", 1110 | "description": "Skipped when true.", 1111 | "type": { 1112 | "kind": "NON_NULL", 1113 | "name": null, 1114 | "ofType": { 1115 | "kind": "SCALAR", 1116 | "name": "Boolean", 1117 | "ofType": null 1118 | } 1119 | }, 1120 | "defaultValue": null 1121 | } 1122 | ] 1123 | }, 1124 | { 1125 | "name": "include", 1126 | "description": "Directs the executor to include this field or fragment only when the `if` argument is true.", 1127 | "locations": [ 1128 | "FIELD", 1129 | "FRAGMENT_SPREAD", 1130 | "INLINE_FRAGMENT" 1131 | ], 1132 | "args": [ 1133 | { 1134 | "name": "if", 1135 | "description": "Included when true.", 1136 | "type": { 1137 | "kind": "NON_NULL", 1138 | "name": null, 1139 | "ofType": { 1140 | "kind": "SCALAR", 1141 | "name": "Boolean", 1142 | "ofType": null 1143 | } 1144 | }, 1145 | "defaultValue": null 1146 | } 1147 | ] 1148 | }, 1149 | { 1150 | "name": "deprecated", 1151 | "description": "Marks an element of a GraphQL schema as no longer supported.", 1152 | "locations": [ 1153 | "FIELD_DEFINITION", 1154 | "ENUM_VALUE" 1155 | ], 1156 | "args": [ 1157 | { 1158 | "name": "reason", 1159 | "description": "Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax (as specified by [CommonMark](https://commonmark.org/).", 1160 | "type": { 1161 | "kind": "SCALAR", 1162 | "name": "String", 1163 | "ofType": null 1164 | }, 1165 | "defaultValue": "\"No longer supported\"" 1166 | } 1167 | ] 1168 | } 1169 | ] 1170 | } 1171 | } --------------------------------------------------------------------------------