1.0.1 • Published 7 years ago

@nodeframe/apollo-tools v1.0.1

Weekly downloads
1
License
ISC
Repository
github
Last release
7 years ago

Features

  • wite Resolver with es-decorator styke

you can write a resolver like this

  import GraphQLTools from '@nodeframe/apollo-tool'

  class CommentSchema extends GraphQLTools.GraphQLResolver {
    
    @GraphQLTools.Query
    comments(...){
      ...
    }

    @GraphQLTools.Query
    comment(...){
      ...
    }

    @GraphQLTools.Mutation
    addComment(...){
      ...
    } 

    @GraphQLTools.Subscription
    commentAdded(...){
      ...
    } 

  }

Usage

  const comment = new CommentSchema()
  

comment.Resolvers will be transformed to

{
  Query:{
    comments(...){

    }
    comment(...){

    }
  },
  Mutation:{
    addComment(...){

    }
  },
  Subscription:{
    commentAdded(...){

    }
  }
}

Utilities

You can merge many schemas with GraphQLTools.createResolvers

GraphQLTools.createResolvers(
  CommentSchema,
  TaskSchema
)