Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including graphql-plugins with all npm packages installed. Try it out:

var graphqlPlugins = require("graphql-plugins")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

graphql-plugins v1.1.0

Plugin-based GraphQL system

GraphQL Plugins for Zox.js

npm i zox zox-plugins graphql-plugins

Zox.js was created with one goal in mind: Making scalable systems
And this can easily be achieved using the graphql-plugins.

Resolvers

Easily assign resolvers to fields.

@Resolver('Post', 'author', PostTypeDefs)
export class AuthorResolver implements IResolver
{
    public handle(source: Post, args, context, info: GraphQLResolveInfo): User
    {
        return users.find(u => u.id == source.user);
    }
}

Top-Level Fields

Declare top-level fields anywhere in your code.

@Query('user(id: ID!): User', UserDef)
export class UserQuery extends ResolverBase
{
    public resolve(root, args, context): Array<UserData>
    {
        return users.find(u => u.id == args.id);
    }
}

Subscriptions

Use Event Emitters as GraphQL Subscription endpoints that can be accessed over a Web Socket.

@Subscription('post: Post', PostTypeDefs)
export class PostSubscription extends SubscriptionEventResolverBase
{
    public eventNames: Array<string> = [postCreated, postUpdates, postDeleted];
    public eventEmitter: EventEmitter = eventEmitter;
}
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free