Last active
May 30, 2019 20:28
-
-
Save vish448/12a26de4781390396398af1f6e12138b to your computer and use it in GitHub Desktop.
Setting up environment presets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"presets": [ | |
"env" | |
] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { GraphQLServer } from 'graphql-yoga' | |
//Type definations (Application Schema) | |
//Describes the operations and the data structures. | |
const typeDefs = ` | |
type Query { | |
hello: String! | |
} | |
` | |
//Resolvers object for our API | |
// These are the functions that acutally run when various oprations are performed. | |
const resolvers = { | |
Query: { | |
hello() { | |
return "Hello World!" | |
} | |
} | |
} | |
const server = new GraphQLServer({ | |
typeDefs, | |
resolvers | |
}) | |
server.start(()=>{ | |
console.log('The Sever is up!') | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "graphql-local-server", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"start": "babel-node src/index.js", | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "", | |
"license": "ISC", | |
"dependencies": { | |
"babel-cli": "^6.26.0", | |
"babel-preset-env": "^1.7.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment