Guest User

Untitled

a guest
May 16th, 2018
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. const express = require('express');
  2. const egraphql = require('express-graphql');
  3. const {buildSchema} = require('graphql');
  4.  
  5. const schema = buildSchema(`
  6. type Query {
  7. message: String
  8. }
  9. `);
  10.  
  11. const root = {
  12. message: ()=> 'Hello world!',
  13. };
  14.  
  15. const app = express();
  16. app.use('/graphql', egraphql({
  17. schema: schema,
  18. rootValue: root,
  19. graphiql: true,
  20. }));
  21.  
  22. app.listen(5000, ()=> console.log('running ', 5000));
Add Comment
Please, Sign In to add comment