Closed nghiepdev closed 8 years ago
@tronghiep92 there are a couple of projects that are based on Apollo Server and uses Dataloader as well:
https://github.com/apollostack/GitHunt https://github.com/nnance/swapi-apollo
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.