GraphQL
As we saw above, REST is one paradigm when designing APIs, but there is a new way to think about creating and consuming APIs: GraphQL. With GraphQL, instead of each resource having its own URL pointing to it, a URL will accept a query parameter with a JSON object in it. This JSON object defines the type and format of the data to return. Nest provides functionality for this through the @nestjs/graphql
package. This will include the GraphQLModule
in the project, which is a wrapper around the Apollo server. GraphQL is a topic that could have an entire book written about it, so we don’t go into it any further in this book.