Apollo/GraphIQL 显示 "Apollo Server supports only POST requests"?

Apollo/GraphIQL Shows "Apollo Server supports only POST requests"?

我已经安装了 Apollo/GraphQL。当我在 http://localhost:8080/graphql 访问 GraphiQL 而不是 GraphiQL 用户界面时,我看到了这条消息:

Apollo Server supports only POST requests.

我已经安装了 Apollo Server 0。2.x 此处文档指定的代码:

http://docs.apollostack.com/apollo-server/migration.html

如何显示 GraphiQL 用户界面?

非常感谢大家的任何想法或信息!

如果您按照说明操作,graphiql 将在 /graphiql 上 运行(注意额外的 'i')

对于任何像我一样偶然发现这个问题的人,在 graphql-server 中有一个临时的 issue

这就是为什么您目前无法在 /graphql(您指定的端点 URL)访问 graphiql,代码如下:

app.use('/graphql', bodyParser.json(), graphqlExpress({ schema }));
app.use('/graphiql', graphiqlExpress({ endpointURL: '/graphql' }));

我在这里发帖是因为这个问题会导致原始问题所问的确切问题(因此在我的故障排除过程中,这个帖子作为仅有的几个搜索结果之一出现)。