自动生成 GraphQL API 接口
Autogenerate GraphQL API interface
我正在使用 Apollo 访问 GraphQL 端点。我在一个文件中有完整的模式。假设架构如下:
type Widget {
widgetId: ID!
name: String
}
type Query {
listWidgets: [Widget!]!
}
type Mutation {
updateWidget(
widgetId: ID!
name: String
): Widget!
}
我想创建一个具有如下接口的 API 对象:
const api = MyApi(endpoint);
const widgets = await api.listWidgets();
const modifiedWidget = await api.updateWidget({
widgetId: 'myId',
name: 'My widget',
});
是否有执行此操作的现有系统?
到目前为止,我在研究中看到的最强大的东西是 graphql-sequelize,它是 Sequelize 接口的 graphql 数据库后端,是目前 Node.js 更流行的 ORM 之一。
我正在使用 Apollo 访问 GraphQL 端点。我在一个文件中有完整的模式。假设架构如下:
type Widget {
widgetId: ID!
name: String
}
type Query {
listWidgets: [Widget!]!
}
type Mutation {
updateWidget(
widgetId: ID!
name: String
): Widget!
}
我想创建一个具有如下接口的 API 对象:
const api = MyApi(endpoint);
const widgets = await api.listWidgets();
const modifiedWidget = await api.updateWidget({
widgetId: 'myId',
name: 'My widget',
});
是否有执行此操作的现有系统?
到目前为止,我在研究中看到的最强大的东西是 graphql-sequelize,它是 Sequelize 接口的 graphql 数据库后端,是目前 Node.js 更流行的 ORM 之一。