chore: serve graphql explorer only on development
This commit is contained in:
@@ -1,10 +1,11 @@
|
|||||||
import { join } from 'path';
|
import { join } from 'node:path';
|
||||||
import { graphqlHTTP } from 'express-graphql';
|
import { graphqlHTTP } from 'express-graphql';
|
||||||
import { loadSchemaSync } from '@graphql-tools/load';
|
import { loadSchemaSync } from '@graphql-tools/load';
|
||||||
import { GraphQLFileLoader } from '@graphql-tools/graphql-file-loader';
|
import { GraphQLFileLoader } from '@graphql-tools/graphql-file-loader';
|
||||||
import { addResolversToSchema } from '@graphql-tools/schema';
|
import { addResolversToSchema } from '@graphql-tools/schema';
|
||||||
import { applyMiddleware } from 'graphql-middleware';
|
import { applyMiddleware } from 'graphql-middleware';
|
||||||
|
|
||||||
|
import appConfig from '../config/app';
|
||||||
import logger from '../helpers/logger';
|
import logger from '../helpers/logger';
|
||||||
import authentication from '../helpers/authentication';
|
import authentication from '../helpers/authentication';
|
||||||
import * as Sentry from '../helpers/sentry.ee';
|
import * as Sentry from '../helpers/sentry.ee';
|
||||||
@@ -22,7 +23,7 @@ const schemaWithResolvers = addResolversToSchema({
|
|||||||
|
|
||||||
const graphQLInstance = graphqlHTTP({
|
const graphQLInstance = graphqlHTTP({
|
||||||
schema: applyMiddleware(schemaWithResolvers, authentication),
|
schema: applyMiddleware(schemaWithResolvers, authentication),
|
||||||
graphiql: true,
|
graphiql: appConfig.isDev,
|
||||||
customFormatErrorFn: (error) => {
|
customFormatErrorFn: (error) => {
|
||||||
logger.error(error.path + ' : ' + error.message + '\n' + error.stack);
|
logger.error(error.path + ' : ' + error.message + '\n' + error.stack);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user