Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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));
Add Comment
Please, Sign In to add comment