-
Notifications
You must be signed in to change notification settings - Fork 115
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
Nest.js vs graphql-modules for new project. Or both? #817
Comments
You should choose one of them, but not both. It depends on what kind of style you like to write grapql. @Resolver('Author')
export class AuthorResolver {
constructor(
private readonly authorsService: AuthorsService,
private readonly postsService: PostsService,
) {}
@Query()
async author(@Args('id') id: number) {
return this.authorsService.findOneById(id);
}
@ResolveProperty()
async posts(@Parent() author) {
const { id } = author;
return this.postsService.findAll({ authorId: id });
}
} Correspondingly, the pure resolver just an object with lots of resolve functions. just like import authorsService from '...'
const resolvers = {
Query: {
author(parent, args, context, info) {
return authorsService.find(authors, { id: args.id });
},
},
Mutation: {}
} If you prefer that and want DI in the grapql, graphql-module will be your choose. Another factor is whether you want to use Apollo Federation now. Finally, you might want to consider community activity. NestJS has larger community than graphql-module. It looks like @ardatan is the only maintainer now. I hope that the guild members could take more attention on this project. I really hope that this project could maintain it's healthy. |
@LucienLee you can use TypeGraphQL with GraphQL Modules 😉 |
I have experience with Express, Apollo server and related technologies separately, but have never used graphql-modules or nest.js. Do these two combine? If they don't, how can one decide which one to use?
The text was updated successfully, but these errors were encountered: