New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use Dataloader with Apollo server ? #47
Comments
@tronghiep92 there are a couple of projects that are based on Apollo Server and uses Dataloader as well: https://github.com/apollostack/GitHunt Let me know you need a better example |
@tronghiep92 please feel free to re-open the issue, or ask questions on the slack channel if you still need more info. |
@tronghiep92 So basically all you need to do is wrap your item loader with DataLoader and it will automatically group calls, batching them if possible: https://github.com/nnance/swapi-apollo/blob/5e2208db6cb3e91dbb7aa34b531454a57c6a973f/src/connectors/swapi.ts#L10-L16 However, these examples work with data that does not expire, and you may need to implement cache clearing. The documentation at https://github.com/facebook/dataloader/blob/master/README.md is good, I think. |
I see great https://youtu.be/UBGzsb2UkeY?t=24m45s use Dataloader.
How to use Dataloader with Apollo server? I'm using MongoDB.
Please give me an example.
Tks.
The text was updated successfully, but these errors were encountered: