chore: serve graphql explorer only on development

This commit is contained in:
Ali BARIN
2023-05-12 15:17:35 +00:00
parent 815e64302e
commit f52afc1fe0

View File

@@ -1,10 +1,11 @@
import { join } from 'path';
import { join } from 'node:path';
import { graphqlHTTP } from 'express-graphql';
import { loadSchemaSync } from '@graphql-tools/load';
import { GraphQLFileLoader } from '@graphql-tools/graphql-file-loader';
import { addResolversToSchema } from '@graphql-tools/schema';
import { applyMiddleware } from 'graphql-middleware';
import appConfig from '../config/app';
import logger from '../helpers/logger';
import authentication from '../helpers/authentication';
import * as Sentry from '../helpers/sentry.ee';
@@ -22,7 +23,7 @@ const schemaWithResolvers = addResolversToSchema({
const graphQLInstance = graphqlHTTP({
schema: applyMiddleware(schemaWithResolvers, authentication),
graphiql: true,
graphiql: appConfig.isDev,
customFormatErrorFn: (error) => {
logger.error(error.path + ' : ' + error.message + '\n' + error.stack);