Initial implementation at plugins

This commit is contained in:
Wyatt Johnson
2017-03-14 17:46:04 -06:00
parent 15e962c985
commit fff9d84303
11 changed files with 334 additions and 23 deletions
+9 -3
View File
@@ -1,11 +1,17 @@
const tools = require('graphql-tools');
const maskErrors = require('graphql-errors').maskErrors;
const {makeExecutableSchema} = require('graphql-tools');
const {maskErrors} = require('graphql-errors');
const {decorateWithHooks} = require('./hooks');
const plugins = require('../plugins');
const resolvers = require('./resolvers');
const typeDefs = require('./typeDefs');
const schema = tools.makeExecutableSchema({typeDefs, resolvers});
const schema = makeExecutableSchema({typeDefs, resolvers});
// Plugin to the schema level resolvers to provide an before/after hook.
decorateWithHooks(schema, plugins.get('server', 'hooks'));
// If we are in production mode, don't show server errors to the front end.
if (process.env.NODE_ENV === 'production') {
// Mask errors that are thrown if we are in a production environment.