chore: update GraphQL module configuration and enhance server plugins
- Added ApolloServerPluginLandingPageLocalDefault for improved GraphQL playground experience. - Disabled playground in production by setting it to false for better security. - Updated logger configuration for clearer debugging and error handling in the GraphQL module.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { Global, Logger, Module } from '@nestjs/common'
|
||||
|
||||
import { ApolloServerPluginLandingPageLocalDefault } from '@apollo/server/plugin/landingPage/default'
|
||||
import { ApolloDriverConfig } from '@nestjs/apollo'
|
||||
import { ConfigModule } from '@nestjs/config'
|
||||
import { GraphQLModule } from '@nestjs/graphql'
|
||||
@@ -47,7 +48,6 @@ import { CommonModule } from '../common/common.module'
|
||||
import { Builder } from './graphql.builder'
|
||||
import { PrismaCrudGenerator } from './graphql.generator'
|
||||
import { GraphqlService } from './graphql.service'
|
||||
|
||||
@Global()
|
||||
@Module({
|
||||
imports: [
|
||||
@@ -98,7 +98,7 @@ import { GraphqlService } from './graphql.service'
|
||||
useFactory: async (graphqlService: GraphqlService, pubsub: RedisPubSub) => ({
|
||||
path: process.env.API_PATH + '/graphql',
|
||||
debug: process.env.NODE_ENV === 'development' || false,
|
||||
playground: process.env.NODE_ENV === 'development' || false,
|
||||
playground: false,
|
||||
introspection: process.env.NODE_ENV === 'development' || false,
|
||||
logger: {
|
||||
debug: (...args) => Logger.debug(...args, 'GraphqlModule'),
|
||||
@@ -106,6 +106,7 @@ import { GraphqlService } from './graphql.service'
|
||||
warn: (...args) => Logger.warn(...args, 'GraphqlModule'),
|
||||
error: (...args) => Logger.error(...args, 'GraphqlModule'),
|
||||
},
|
||||
plugins: [ApolloServerPluginLandingPageLocalDefault()],
|
||||
installSubscriptionHandlers: true,
|
||||
subscriptions: {
|
||||
'graphql-ws': {
|
||||
|
||||
Reference in New Issue
Block a user