问题描述
如何将 userThat(可能还有其他几个相关字段)重构为其他不错的模块化文件,然后将它们包含到 root_query_type.js 中
这是一个普通的 node/express/graphql GraphQLObjectType 实现。
还是我注定拥有一个巨大的 root_query_type.js ?
schema.js
module.exports = new GraphQLSchema({
query: RootQueryType
});
root_query_type.js
const RootQueryType = new GraphQLObjectType({
name: 'RootQueryType',fields: {
userThis: {
type: UserType,resolve(parentValue,args,request) {
return thisResult;
}
},userThat: {
type: UserType,args: {
thatArgs: { type: new GraphQLNonNull(GraphQLString) },},resolve: (parentValue,arg,request) => {
return thatResult;
},
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)