如何在 Strapi 应用程序中将 graphql 添加到 Heroku?

Afx*_*ush 1 deployment url heroku graphql strapi

我使用 MongoDb、Cloudinary(用于图像)和 Heroku(用于部署)制作了一个 Strapi 应用程序。我在部署 Graphql 之前安装了它。它在本地主机的开发模式下工作正常,graphql 游乐场显示正常。但在生产中,我在尝试显示 graphql 游乐场时遇到错误。它只显示一个空白页面,其中包含以下消息:

缺少 GET 查询

如果 url“some_name.heroku.com/graphql”不起作用,如何使用 graphql/Apollo 查询我的数据?

Afx*_*ush 5

好吧,我在 github 论坛中发现我必须在 plugins.js 文件中添加一些代码才能使 graphql 在生产中工作。这是代码:

module.exports = ({ env }) => ({
  //
  graphql: {
     config: {
        endpoint: "/graphql",
        shadowCRUD: true,
        playgroundAlways: true,
        depthLimit: 100,
        apolloServer: {
          tracing: false,
          },
        },
     }, 
   });
Run Code Online (Sandbox Code Playgroud)

之后我必须在我的存储库中提交更改并等待 heroku 部署它。