Strapi GraphQL API - 405 方法不允许

Strapi GraphQL API - 405 Method Not Allowed

我刚刚按照文档将我的 Strapi API 部署到生产环境:https://strapi.io/documentation/v3.x/deployment/heroku.html

并且通过从其他来源发出 POST 请求,我得到了这个错误:

由于我的 API 终于在开发(localhost 到 localhost)上工作了,我认为这个问题与 CORS 有关,如果是的话,那就是我在 [=29= 上设置的 cors 配置]:

config/env/production/security.json:

{
  "cors": {
    "enabled": true,
    "origin": "*"
  }
}

config/env/production/middleware.js:

module.exports = {
  settings: {
    cors: {
      enabled: true,
      origin: "*",
    },
  },
};

我在开发环境上添加了cors配置...

为了在生产环境中更改cors配置,以上代码应放在以下路径:

config/env/production/security.json 
config/env/production/middleware.js

对我来说,它缺少 api/blog/config/routes.json

中的路线
{
  "method": "POST",
  "path": "/blog",
  "handler": "blog.create",
  "config": {
    "policies": []
  }
},

在我的例子中,因为我使用 GraphQL 进行查询,所以我应该在生成的末尾添加 /graphql URL 就像我们对 localhost:1337/graphql.

所做的那样