Strapi GraphQL策略
我尝试在Strapi项目上使用GraphQL模块。我想添加新的查询。您可以看到我的代码:Strapi GraphQL策略,graphql,strapi,Graphql,Strapi,我尝试在Strapi项目上使用GraphQL模块。我想添加新的查询。您可以看到我的代码: { "routes": [ { "method": "GET", "path": "/recipes", "handler": "Recipes.recipes" } ] } 和我的模式: module.exports = { definition: ` type Recipe { title: String! }
{
"routes": [
{
"method": "GET",
"path": "/recipes",
"handler": "Recipes.recipes"
}
]
}
和我的模式:
module.exports = {
definition: `
type Recipe {
title: String!
}
`,
query: `
recipes: Recipe
`,
resolver: {
Query: {
recipes: {
description: 'Return a single Recipe',
resolver: 'Recipes.recipes'
}
}
}
};
我的查询返回错误403。但是,如果我用CURL命令尝试我的URL,我得到了正确的响应
有人知道我是否需要为没有策略的GraphQL查询添加其他参数吗
谢谢大家! 您的路线
/receipes
缺少config
键。所以一定要加上它。
然后,当您请求此路由时,请确保允许您的用户使用此路由
这里有一些关于这个的文件
关于GraphQL查询-这里有一些文档: