如何配置 GraphQL Codegen 以输出可在 Node.js 中使用的客户端?
我一直在使用 https://www.graphql-code-generator.com/ 来暂时生成 TypeScript 定义、Apollo Hooks 和 GraphQL 解析器。
但现在我希望它生成可以在 Node.js
节点上使用的 Apollo 客户端函数 示例:
const { contacts } = await queryContacts(search: 'Jack');
for (const contact of contacts) {
// ...
}
如何配置 codegen.yaml 来生成 Apollo 客户端函数,类似于 queryContacts< /代码>?
I have been using https://www.graphql-code-generator.com/ to generate TypeScript definitions, Apollo Hooks and resolvers for GraphQL for a while.
But now I would like it to generate Apollo client functions that I could use on Node.js
Node Example:
const { contacts } = await queryContacts(search: 'Jack');
for (const contact of contacts) {
// ...
}
How do I configure codegen.yaml
to generate an Apollo client function, similar to queryContacts
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在插件中添加打字稿操作
例如:
add typescript-operation in plugins
for example: