Using databases in GraphQL
GraphQL is a protocol for sending and receiving data. Apollo is one of the many libraries that you can use to implement that protocol. Neither GraphQL (in its specifications) nor Apollo work directly on the data layer. Where the data that you put into your response comes from, and where the data that you send with your request is saved, are up to the user to decide.
This logic indicates that the database and the services that you use do not matter to Apollo, as long as the data that you respond with matches the GraphQL schema.
As we are living in the Node.js ecosystem in this project and book, it would be fitting to use MongoDB. MongoDB offers a great client library for Node.js, and also uses JavaScript as its native ...
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