Files
talk/graph/schema.js
T
2017-09-06 22:11:48 +07:00

18 lines
618 B
JavaScript

const {makeExecutableSchema} = require('graphql-tools');
const {decorateWithHooks} = require('./hooks');
const {decorateWithErrorHandler} = require('./errorHandler');
const plugins = require('../services/plugins');
const resolvers = require('./resolvers');
const typeDefs = require('./typeDefs');
const schema = makeExecutableSchema({typeDefs, resolvers});
// Plugin to the schema level resolvers to provide an before/after hook.
decorateWithHooks(schema, plugins.get('server', 'hooks'));
// Handle errors like masking in production and mutation errors.
decorateWithErrorHandler(schema);
module.exports = schema;