@apollo/server-plugin-landing-page-graphql-playground

中文文档
4.0.1发布于 2023/05/27MITTypeScriptESM + CJS近 30 天下载 402.3万

Apollo Server landing page plugin for GraphQL Playground

此软件包已被标记为弃用

The use of GraphQL Playground in Apollo Server was supported in previous versions, but this is no longer the case as of December 31, 2022. This package exists for v4 migration purposes only. We do not intend to resolve security issues or other bugs with this package if they arise, so please migrate away from this to [Apollo Server's default Explorer](https://www.apollographql.com/docs/apollo-server/api/plugin/landing-pages) as soon as possible.

原始使用文档

GraphQL Playground plugin

⚠️ Note: The use of GraphQL Playground in Apollo Server was supported in previous versions, but this is no longer the case as of December 31, 2022. This package is deprecated and exists for v4 migration purposes only. We do not intend to resolve security issues or other bugs with this package if they arise, so please migrate away from this to Apollo Server's default Explorer as soon as possible. ⚠️

This is a plugin for Apollo Server 4 that makes your GraphQL server serve the GraphQL Playground IDE as a landing page.

GraphQL Playground was the only landing page available for Apollo Server 2. The GraphQL Playground project is officially retired and we do not recommend its continued use. We recommend Apollo Server 4's default landing page, which serves the similar but actively maintained Apollo Sandbox, or a custom landing page.

To help developers migrating from Apollo Server 2, we do still provide a landing page plugin that allows you to use GraphQL Playground with Apollo Server. In Apollo Server 3, that plugin is distributed as part of the apollo-server-core package. In Apollo Server 4, that plugin is distributed separately in this package.

To use GraphQL Playground with Apollo Server 4, first npm install @apollo/server-plugin-landing-page-graphql-playground, and then:

import { ApolloServer } from '@apollo/server';
import { ApolloServerPluginLandingPageGraphQLPlayground } from '@apollo/server-plugin-landing-page-graphql-playground';

const server = new ApolloServer({
  plugins: [ApolloServerPluginLandingPageGraphQLPlayground()],
  // ... other options ...
});

Note that this will serve GraphQL Playground unconditionally. If you would prefer to only serve it when not in production, you can use process.env.NODE_ENV to determine whether to include the plugin in the plugins option yourself.

版本与发布记录

@apollo/server-plugin-landing-page-graphql-playground 共发布 3 个版本,首次发布于 2022/08/16;过去 12 个月发布了 0 个版本。

版本发布日期距今
4.0.1latest2023/05/273 年前
4.0.02022/10/114 年前
4.0.0-alpha.0alpha2022/08/164 年前

关于 @apollo/server-plugin-landing-page-graphql-playground 的常见问题

@apollo/server-plugin-landing-page-graphql-playground 是什么?

Apollo Server landing page plugin for GraphQL Playground注意:该包已被作者标记为弃用——The use of GraphQL Playground in Apollo Server was supported in previous versions, but this is no longer the case as of December 31, 2022. This package exists for v4 migration purposes only. We do not intend to resolve security issues or other bugs with this package if they arise, so please migrate away from this to [Apollo Server's default Explorer](https://www.apollographql.com/docs/apollo-server/api/plugin/landing-pages) as soon as possible.

如何安装 @apollo/server-plugin-landing-page-graphql-playground?

在项目目录运行 npm install @apollo/server-plugin-landing-page-graphql-playground,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@apollo/server(^4.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@apollo/server-plugin-landing-page-graphql-playground 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@apollo/server-plugin-landing-page-graphql-playground 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@apollo/server-plugin-landing-page-graphql-playground 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=14.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@apollo/server-plugin-landing-page-graphql-playground 可以商用吗?

@apollo/server-plugin-landing-page-graphql-playground 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@apollo/server-plugin-landing-page-graphql-playground 的下载量有多少?

根据 npm 官方下载统计,@apollo/server-plugin-landing-page-graphql-playground 在 2026/10/07 – 2026/11/05 这 30 天内被下载 4,023,322 次,日均约 134,111 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@apollo/server-plugin-landing-page-graphql-playground 还在维护吗?

最新版本 4.0.1 发布于 2023/05/27(3 年前);至今共发布 3 个版本,其中过去 12 个月发布了 0 个;首次发布于 2022/08/16。作者已将其标记为弃用,新项目建议寻找替代方案。