Introducing GraphQLHub-Schemas
Use Popular APIs with GraphQL, now on NPM
I started GraphQLHub because people wanted to learn about GraphQL and Relay without needing their own server. The project has been open-source almost from the get-go, but using the GraphQLHub code on your own wasn’t really possible — until now!
The GraphQLHub-Schemas NPM package contains the GraphQL code to connect to Reddit, Twitter, Github, and more. Here’s how you can use it:
$ npm i graphql graphqlhub-schemas --saveimport { Reddit } from 'graphqlhub-schemas';
import { GraphQLSchema, graphql } from 'graphql';
let schema = new GraphQLSchema({
query: Reddit.QueryObjectType
});
let query = ' { user(username: "kn0thing") { username } } ';
graphql(schema, query).then((result) => {
console.log(result);
});
And if you want to explore the schemas right now, you can always use GraphQLHub. If you have feature requests or run into problems, don’t be afraid to drop an issue on Github.
GraphQLHub has seen awesome community contributions over the past few months and I’m excited to see it grow.
Publishing the schemas on NPM is a great step in making GraphQL more accessible — and there’s more to come :)
To stay updated on GraphQL and GraphQLHub, follow @GraphQLHub on Twitter or my posts here on Medium