21%
MIT
neglectedBuckleScript binding for graphql-tools

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!

  • RE
  • ML
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 } }");
583: <UNKNOWN SYNTAX ERROR>