添加远程模式
我们已编写自定义解析器并将其部署到 Glitch。 我们已准备好 GraphQL 端点。 让我们将其添加到 Hasura,作为一个远程模式。
添加
转到控制台的Remote Schemas
选项卡,然后单击Add
按钮。
为该远程模式命名(比如 Auth0)。 在 GraphQL 服务器 URL 中,输入你刚刚在上一步部署的 Glitch 应用程序 url。
选择Add Remote Schema
,然后单击Forward all headers from the client
。
试一下
转到“控制台 GraphiQL”选项卡,然后了解以下 GraphQL 查询。
query {auth0 {picture}}
还记得我们在配置 Auth0 并将其测试后得到的 JWT 令牌吗? 在这里,你还需要使用相同的 JWT 令牌传入Authorization
标头,以获取正确的数据。
如你所见,Hasura 已通过 Postgres 将自定义 GraphQL 模式与现有的自动生成的 API 合并。
Did you find this page helpful?
Start with GraphQL on Hasura for Free
Build apps and APIs 10x faster
Built-in authorization and caching
8x more performant than hand-rolled APIs

