fenos / graphql-thinky

GraphQL & Relay powered by thinky / RethinkDB. https://graphql-thinky.readme.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Upgrade the documentation to 0.4.0

gutenye opened this issue · comments

commented

The current website documentation is for 0.3.0, while I try to use 0.4.0, got errors about relationship and dataloader, I can't recall the error details

How to use the 0.4.0? I really like the new dataloader cache.

Documentation is working progress for v0.4 the high level api doesn't change much. Can u provide the stack trace I may help

commented

My code is https://gist.github.com/gutenye/f8a81155a7500c8501d94d7163476ac9

Works fine on 0.3.0
But got error on relationship and dataloader on 0.4.0
I assume API changes.

 "errors": [
    {
      "message": "\n          GraphQL-thinky couldn't find any loaders set on the GraphQL context\n          with the key \"loaders\"\n        ",
      "locations": [
        {
          "line": 5,
          "column": 7
        }
      ],
      "path": [
        "post",
        "author"
      ]
    },

@gutenye Sorry I missed your comment somehow, apologize for the delay.

As GraphQL-thinky version 0.4 uses Dataloader it want us to create new instances of Dataloader for every request, then pass those instances into the Context of GraphQL.

Here's how: Loaders to context

This has to be done once, and it is the only step todo from the version 0.3 to 0.4.

import GT from './yourGraphqlThinkyInstance';

app.use('/graphql',(req,res) => {
  return expressGraphql({
    schema,
    graphiql: true,
    pretty: true,
    context: {
      loaders: GT.getModelLoaders(),
    }
  })(req,res);
});

I apologize for the delay on documenting the version 0.4 but soon I'll have time to came back and officially release it, thanks for your patience.

In the mean time if you check the example folder into the dataloader branch will give you clues where the documentation is not yet clear.

Let me know if that helps

Hi @fenos, I'm just evaluating this library now. Has the documentation been updated yet?

Hi guys, sorry for delay I been very busy lately, I updated the Doc at least to get started with v0.4 I'm thinking to move the Doc into github Pages I will go in more detail once I've done that.