The NestJS GraphQL plugin
As we mentioned earlier, NestJS supports plugins and some of those are officially supported. The GraphQL plugin for NestJS is one of those.
This plugin provides a NestJS module called GraphQLModule. It is nothing more than a wrapper around the Apollo server. Its goal is mainly to facilitate its integration within NestJS applications, and it does a great job of that.
The GraphQL plugin for NestJS supports two different approaches.
With the schema-first approach, you start by defining the GraphQL schema, which becomes the single source of truth for the application. The alternative way is to use a code-first approach. In that case, the source of truth is the application code, which we need to decorate in order for the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access