- 只是为了确认一下,NextJS 和 Gatsby 都连接到与 GraphQL 兼容的 Strapi api,并且我的服务器在 http://localhost:1337 上运行
- 另外,我可以通过 http://localhost:1337/graphql 访问 GraphQL 游乐场
然而,Gatsby 让我能够通过 GraphiQL 在 http://localhost:8000/___graphiql 上运行 GraphQL,这就是我的差异开始的地方......
- Gatsby 提供的 http://localhost:8000/ 上的 GraphiQL 非常棒。我更喜欢 GraphQL 操场,您将在 http://localhost:1337/graphql 的暗模式下在底部屏幕截图中看到它
这是我通过 GraphiQL 运行的关于 Gatsby 的成功 GraphQL 查询:

- 我希望 GraphiQL 中的相同查询在 http://localhost:1337/graphql 上的 Strapi 后端服务器中工作
- 确切地说,这是在 GraphiQL 上成功运行的 GraphQL 查询:
query MyQuery {
allStrapiProduct(filter: {featured: {eq: true}}) {
edges {
node {
name
strapiId
variants {
price
qty
product
}
}
}
}
}
在这里,我尝试通过 http://localhost:1337/graphql 上的标准 GraphQL 操场通过我的 Strapi 后端服务器运行 GraphQL 查询,以便我可以将其包含在我的 NextJS 项目中:

请帮助获取这个 GraphiQL 查询以及我通过 Gatsby 运行的所有其他 GraphiQL 查询,以便通过 NextJS 工作!
