sikanhe / reason-graphql

GraphQL server in pure Reason (Bucklescript)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How do you use it?

matzero opened this issue · comments

commented

I've clone it compile it, run the tests, now how do I run the server?

Hey @matzero I am creating an example repository soon with a server example. Stay tuned. The TLDR is that you have to parse the post request into query string and variables (using https://github.com/sikanhe/reason-graphql/blob/master/src/Graphql_Json.re#L24) and pass it to the schema.

@matzero Just released a (experimental) middleware package for bs-express. You can check out the usage here: https://github.com/sikanhe/reason-graphql/blob/master/reason-graphql-bs-express/examples/server.re

If you want to run it on your own server implementation you can peek into the package to see how I parsed the request body to feed it to the graphql server execution function.

To make it work you would want to install reason-graphql and reason-graphql-bs-express at latest versions.

commented

@sikanhe this is great! Let me take a gander later on this week and I will report back.