【问题标题】:How to add custom resolvers to prisma cloud graphql backend?如何将自定义解析器添加到 prisma cloud graphql 后端?
【发布时间】:2019-10-24 09:24:44
【问题描述】:

我正在开发一个通过 CRA 提升的 React 项目。我正在使用 prisma cloud,它为我生成基本查询、突变等,这很好但还不够:(。我想知道是否可以将我的自定义解析器添加到 prisma-schema.js 中已经内置的解析器中。如果是这样,在哪里以及如何添加它们?

import { HttpLink } from "apollo-link-http";
import { InMemoryCache } from "apollo-cache-inmemory";

const client = new ApolloClient({
  // By default, this client will send queries to the
  //  `/graphql` endpoint on the same host
  // Pass the configuration option { uri: YOUR_GRAPHQL_API_URL } to the `HttpLink` to connect
  // to a different host
  link: new HttpLink({
    uri: "https://eu1.prisma.sh/xxx/xxx/dev"
  }),
  cache: new InMemoryCache()
});

export default client;

我的期望是能够同时 - 将自定义字段添加到当前查询 - 进行自定义查询。

【问题讨论】:

    标签: reactjs graphql prisma


    【解决方案1】:

    您无法向 Prisma 生成的架构添加更多解析器。

    如果您想在 Prisma 生成的基础上添加功能,您需要遵循文档中的架构:

    我鼓励您阅读此页面的文档,这将有助于您了解如何将 Prisma 集成到您的项目中:https://www.prisma.io/docs/understand-prisma/prisma-basics-datamodel-client-and-server-fgz4/

    【讨论】:

      猜你喜欢
      • 2019-09-29
      • 2020-04-05
      • 2021-12-22
      • 1970-01-01
      • 2020-02-03
      • 1970-01-01
      • 2020-10-04
      • 2020-10-07
      • 1970-01-01
      相关资源
      最近更新 更多