Skip to content

Instantly share code, notes, and snippets.

@vish448
Last active May 30, 2019 20:28
Show Gist options
  • Save vish448/12a26de4781390396398af1f6e12138b to your computer and use it in GitHub Desktop.
Save vish448/12a26de4781390396398af1f6e12138b to your computer and use it in GitHub Desktop.
Setting up environment presets
{
"presets": [
"env"
]
}
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!')
})
{
"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