node-graphql-service
GraphQL API service which uses multiple microservices as data source.
Requirements
Node 16.15+, docker, docker compose
Installation
- Clone this repo and install dependencies with
npm i
- Install and prepare data source microservices repo:
- Clone and initialise git submodule with
git submodule init && git submodule update
- Install dependencies
cd ./microservices && npm i
- Create .env files for connecting Mongo with services
cd ./microservices for subdir in */; do cp $subdir.env.example $subdir.env2; done;
- Clone and initialise git submodule with
Running
- Run data source DB and services:
- Run Mongo instance
docker compose up
- Run microservices
cd microservices/ && npm run run:all:prod
- Run Mongo instance
- Run GraphQL API:
- Production mode
npm run start
- Development mode
npm run start:dev
- Production mode
- You can run tests with:
npm t
. Tests do not require running GrqphQL backend, just source DB and API.