This is a simple practise project of a GraphQL API backed by a Neo4j database. The major purpose of this project is to
- Create Apollo Server with Neo4j GraphQL integration
- Create integration tests following Apollo Docs: Testing using executeOperation
This project is bootstrapped using node-typescript-boilerplate
Apollo Server is a powerful GraphQL server that can be used with many different data sources. With Neo4j GraphQL library, it's even more powerful.
Developer just need specify datatype and relationship in GraphQL schema, and Neo4j GraphQL library will generate the resolvers automatically for you. It greatly reduce boilerplate code.
Another benefit of Neo4j + Apollo Server is that there is no need to write unit test for many low level web framework functionality, as they are all handled gracefully by these libraries. And our most focus is on integration tests (i.e. whether schema generated typeDef
behave correctly)
But there is not much information about how to write integration tests for Apollo Server with Neo4j GraphQL library. This project demonstrate how to write integration tests using Apollo Server's executeOperation
function.
Pre-requisite
- Installed neo4j database
- Created a database named
neo4j-graphql-books
and start the database
Run the project following step
- Switch node version by
nvm use
- Build:
npm run build
- Start:
npm run start
Run test
npm run test
Run test in containers
npm run test-containers