【发布时间】:2017-07-26 20:39:52
【问题描述】:
我是 GraphQL 的新手。如果这很明显,请原谅我。
除了使用buildSchema,有没有办法使用new GraphQLSchema定义多个查询/突变?
这就是我现在拥有的。
const schema = new graphql.GraphQLSchema(
{
query: new graphql.GraphQLObjectType({
name: 'RootQueryType',
fields: {
count: {
type: graphql.GraphQLInt,
resolve: function () {
return count;
}
}
}
}),
mutation: new graphql.GraphQLObjectType({
name: 'RootMutationType',
fields: {
updateCount: {
type: graphql.GraphQLInt,
description: 'Updates the count',
resolve: function () {
count += 1;
return count;
}
}
}
})
});
【问题讨论】:
标签: graphql