Thursday, 18 July 2019

GraphQL with TypeORM using NestJS, and taking advantage of Dataloader to solve n+1 query problems

It might not be a very Ideal scenario to use GraphQL with SQL database, However, we can't deny the fact that SQL has its own advantage, Now with introduction of GraphQL , Many you us have taken the root to use No-SQL database like Mongoose, but In case you want to stick with both SQL database and GraphQL, there are some issues and complications that can occur.​Thanks to this awesome tutorial, https://codersera.com/blog/nestjs-typeorm-graphql-dataloader-tutorial-with-typescript/ Which solves the problem like a charm,​It basically takes the advantage of typescript ( especially decorators) and typeorm models to wrap things up and make it easy scaffold the project which uses typeorm-nestjs-graphql.​The major concern that most people might have, how it solves the (n+1) query problem, then here is the answer, it employe a very good library called dataloader to get away with those problems and limitations.​Here is the Github repo, if anyone of you wants to clone and play with it. https://github.com/codersera-repo/typeorm-graphql-nestjs-dataloader-starter-kit

Submitted July 18, 2019 at 02:38PM by inboxsubhash988

No comments:

Post a Comment