如何将自定义解析器添加到prisma cloud graphql后端?

时间:2019-06-09 21:40:29

标签: reactjs graphql prisma

我正在研究一个通过CRA推动的React项目。我正在使用prisma云,它为我生成基本查询,变异等,虽然很棒,但还不够:: ..我想知道是否可以将自定义解析器添加到已经在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;

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

1 个答案:

答案 0 :(得分:0)

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

如果要在Prisma生成的内容之上添加功能,则需要遵循文档中的体系结构: Prisma architecture

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