Skip to content

Instantly share code, notes, and snippets.

@4lg4
Created May 11, 2018 07:43
Show Gist options
  • Save 4lg4/08f5bf76855ca069ff7b0e69ec5575a7 to your computer and use it in GitHub Desktop.
Save 4lg4/08f5bf76855ca069ff7b0e69ec5575a7 to your computer and use it in GitHub Desktop.
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