To run the development environment use the npm script:
npm run dev
This command will use docker-compose to setup a mongo database and run the application on port 4000
. The environment variables used are found in the .env.compose
file. Any changes to the codebase will restart the application through nodemon
.
NOTE: If for any reason you want to run the application directly on your machine you will need a mongo database listening on port 27017
.
For example you can run a mongo instance trough a docker container:
docker run -p 27017:27017 mongo:latest
Then you need to use the following npm script:
npm run dev:ts-node:local
The environment variables used are found in the .env.local
file.
By using this command all changes to the codebase won't be reflected on the application unless you restart it manually.
To create a docker image of the application use the following command:
docker build -t syn-test:latest .
It uses rollup.js
to bundle the application and make it easier to dockerize.
To create the rollup.js
bundle use the following npm script:
npm run build
To run tests you will need a mongo database listening on port 27018
.
docker run -p 27018:27017 mongo:latest
Then you need to use the following npm script:
npm test
The environment variables used by the test suite are found in the .env.test
file.