This repository was archived by the owner on Mar 20, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change 1+ import express from 'express' ;
2+ import graphqlHTTP from '../src/' ;
3+ import { buildSchema } from 'graphql' ;
4+
5+ // Construct a schema, using GraphQL schema language
6+ var schema = buildSchema ( `
7+ type Query {
8+ hello: String
9+ }
10+ ` ) ;
11+
12+ // The root provides a resolver function for each API endpoint
13+ var root = {
14+ hello : ( ) => 'Hello world!' ,
15+ } ;
16+
17+ var app = express ( ) ;
18+ app . use ( '/graphql' , graphqlHTTP ( {
19+ schema : schema ,
20+ rootValue : root ,
21+ graphiql : true ,
22+ } ) ) ;
23+ app . listen ( 4000 ) ;
24+ console . log ( 'Running a GraphQL API server at http://localhost:4000/graphql' ) ;
Original file line number Diff line number Diff line change 5454 "cover:lcov" : " babel-node node_modules/.bin/isparta cover --root src --report lcovonly node_modules/.bin/_mocha -- $npm_package_options_mocha" ,
5555 "pretty" : " node resources/pretty.js" ,
5656 "pretty-check" : " node resources/pretty.js --check" ,
57- "preversion" : " npm test"
57+ "preversion" : " npm test" ,
58+ "start" : " babel-node examples/index.js"
5859 },
5960 "dependencies" : {
6061 "accepts" : " ^1.3.0" ,
You can’t perform that action at this time.
0 commit comments