This is a proof of concept about creating a GraphQL schema in a modular way, to improve logic organization, scalability, testability and reusability.
I have used two different approaches:
-
Using the Apollo Server
modules
feature, available from version v2.2.1 and presented in this talk. -
Using the GraphQL Modules toolset, that integrates with Apollo Server.
This repository contains examples for both approaches.
First, clone this repository and install the dependencies:
$ yarn
Then you can start the Apollo Server modules example:
$ npm run start:apollo:modules
or the GraphQL Modules example:
$ npm run start:graphql:modules
The GraphQL Playground will be available at http://localhost:4000
.
You can find some useful queries to test the examples here.