bs-graphql-tools

0.3.1 • Public • Published

bs-graphql-tools

npm version

BuckleScript binding for graphql-tools.

Installation

npm install --save graphql bs-graphql bs-graphql-tools
# or
yarn add graphql bs-graphql bs-graphql-tools

As always, you will need to indicate to BuckleScript that the binding is available.

bsconfig.json

{
  ...
  "bs-dependencies": [
    "bs-graphql",
    "bs-graphql-tools"
  ]
}

Usage

WARNING: Only makeExecutableSchema is implemented for now. More is coming soon but you can always contribute!

let typeDefs = "type Query { me: User } type User { name: String }";
let queryResolvers = {"me": fun () => {"name": "reason"}};
let userResolvers = {"name": fun user => user##name};
let resolvers = {"Query": queryResolvers, "User": userResolvers};
let schema = GraphQLTools.makeExecutableSchema {"typeDefs": typeDefs, "resolvers": resolvers};
Js.log (GraphQL.run schema ::rootValue "{ me { name } }");

Package Sidebar

Install

npm i bs-graphql-tools

Weekly Downloads

0

Version

0.3.1

License

MIT

Last publish

Collaborators

  • rricard