Created
May 11, 2018 07:43
-
-
Save 4lg4/08f5bf76855ca069ff7b0e69ec5575a7 to your computer and use it in GitHub Desktop.
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
const express = require('express'); | |
const egraphql = require('express-graphql'); | |
const {buildSchema} = require('graphql'); | |
const schema = buildSchema(` | |
type Query { | |
message: String | |
} | |
`); | |
const root = { | |
message: ()=> 'Hello world!', | |
}; | |
const app = express(); | |
app.use('/graphql', egraphql({ | |
schema: schema, | |
rootValue: root, | |
graphiql: true, | |
})); | |
app.listen(5000, ()=> console.log('running ', 5000)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment