如果您使用的是Apollo server v3,那么您可能注意到在访问playground时会遇到问题,提示“offline”。这是因为Apollo server v3中默认启用了新的playground FCV插件,但它可能会导致一些问题。
为了解决这个问题,您可以通过使用旧版playground插件来禁用FCV插件。只需将以下代码添加到服务器设置中即可:
const { ApolloServer } = require('apollo-server');
const { ApolloServerPluginLandingPageGraphQLPlayground } = require('apollo-server-core');
const server = new ApolloServer({
//其他的设置项
plugins: [
ApolloServerPluginLandingPageGraphQLPlayground({
// 将此选项设置为旧版插件
version: '1.7.25',
})
],
});
这将使用旧版playground插件,以确保您可以访问playground。