【问题标题】:Graphiql playground in a .Net Framework Web API.Net Framework Web API 中的 Graphiql 游乐场
【发布时间】:2023-03-12 14:56:02
【问题描述】:

我们如何在 ASP.NET Framework Web 应用程序中实现 Graphql Playground?我能够使用 Postman 的新 GraphQL POST 进行查询,并且它按预期工作。但我无法使用 HotChocolate 的 AspNet Classic GraphiQL nuget 托管 graphiql 游乐场。

https://www.nuget.org/packages/HotChocolate.AspNetClassic.GraphiQL/

如果有人可以提供代码 sn-p 或特定于 ASP.NET Framework 的文档,那将非常有帮助。

【问题讨论】:

标签: asp.net-web-api graphql graphiql hotchocolate


【解决方案1】:

您所要做的就是将它添加到您的 startup.cs 文件中:

 //Graph QL add to pipeline and use schemas
 // app.UseWebSockets()
    app.UseGraphQL("/graphql")
       .UsePlayground();

如果您愿意,您也可以自动启动它。每次调试时,如果您在项目属性中设置 url,它将打开 Playground

【讨论】:

    猜你喜欢
    • 2013-04-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-20
    • 2020-01-05
    • 2021-01-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多