Read the latest specification: graphql
Visit the repo for this gist: repo
| const express = require('express'); | |
| const graphqlHTTP = require('express-graphql'); // HTTP server middleware | |
| const fetch = require('node-fetch'); // to perform our POST request | |
| const DataLoader = require('dataloader'); // utility for batching and caching | |
| const cors = require('cors'); // to set up cross-origin resource sharing | |
| const schema = require('./schema'); // our data models | |
| let app = express(); | |
| // Fetch data from the Pokemon API |
| const { | |
| GraphQLSchema, | |
| GraphQLObjectType, | |
| GraphQLInt, | |
| GraphQLString, | |
| GraphQLList | |
| } = require('graphql'); // Reference implementation of graphQL for JavaScript | |
| // Creating a new Object Type, note self-documenting nature of the code | |
| // static-types allow GraphiQL GUI to update with correct fields |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>For JS Debugger Access on Chrome Console</title> | |
| <meta charset="utf-8"> | |
| </head> | |
| <body> | |
| <script src="testFile.js"></script> | |
| </body> | |
| </html> |