BuckleScript binding for graphql-tools.
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"
]
}
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 } }");
583: <UNKNOWN SYNTAX ERROR>