feat(server): change the playground option to GraphiQL. (#13451)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* The GraphQL interactive UI is now available only in development
environments and will not be accessible in production. This change
affects only the availability of the interactive interface; public
exports and API context types remain unchanged. Users in development can
continue to use the tool as before, while production deployments will no
longer expose the interactive UI.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: DarkSky <25152247+darkskygit@users.noreply.github.com>
This commit is contained in:
Jachin
2025-09-22 00:08:30 +08:00
committed by GitHub
parent 363f64ebfa
commit e08fc5ef06

View File

@@ -8,6 +8,7 @@ import { Global, Module } from '@nestjs/common';
import { GraphQLModule } from '@nestjs/graphql';
import type { Request, Response } from 'express';
import { NodeEnv } from '../../env';
import { Config } from '../config';
import { mapAnyError } from '../nestjs/exception';
import { GQLLoggerPlugin } from './logger-plugin';
@@ -30,7 +31,7 @@ export type GraphqlContext = {
numberScalarMode: 'integer',
},
useGlobalPrefix: true,
playground: true,
graphiql: env.NODE_ENV === NodeEnv.Development,
sortSchema: true,
autoSchemaFile: join(
env.projectRoot,