禁用操场时,阿波罗服务器返回 GET 查询丢失 [英] apollo-server returning GET query missing when playground is disabled

查看:22
本文介绍了禁用操场时,阿波罗服务器返回 GET 查询丢失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我模拟 production(又名,playground is disabled)并转到我的根目录时,http://localhost:9000/我收到以下回复:

When I emulate production (aka, playground is disabled) and I go to my root, http://localhost:9000/ I receive the following response:

400 Bad Request

GET query missing

有没有办法防止这种情况或解决方法来呈现其他页面?

Is there a way to prevent this or a workaround to render other page?

我是阿波罗的新手.我只使用 apollo-server(没有快递).我将不胜感激.

I'm new with apollo. I'm using just apollo-server (no express). I will appreciate any help.

推荐答案

Use playground: true:

const server = new ApolloServer({
    introspection: true,
    playground: true,
    typeDefs,
    resolvers,
})

这篇关于禁用操场时,阿波罗服务器返回 GET 查询丢失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆