Table of Contents generated with DocToc
Reusable microservice core.
- Operating System - OS: Ubuntu 20.04 LTS.
- Node.js v17.x
- Yarn v3.x
- Docker v20.x
- Docker Compose v1.29.x
- Insomnia
Beware, the following instructions may not work in a different OS.
From the root directory:
./scripts/install.sh
The script won't work if you move to /scripts
and execute it from there.
./scripts/start.sh
There are 4 environments:
dev
test
stage
prod
The files for dev
and test
are in the repo, ask the team for stage
and prod
if needed.
The dependency manager is Yarn v3.
The database is MongoDB, non-relational. MongoDB is run inside a Docker container. To get inside the Docker container which runs MongoDB:
docker exec -it db bash
To get a JavaScript REPL terminal inside MongoDB:
mongo
To add a user manually to MongoDB:
db
use talent-sourcery-db
db.users.insertOne({ email: '[email protected]', password: 'password' })
db.users.find({}).pretty()
The code style extends AirBNB with some custom rules. ESLint is used to lint the codebase. To lint the code:
yarn lint
It is recommended you install the ESLint extension in VSCode, which will show errors and warnings as you write the code. Errors must be removed, warnings are optional and may stay depending on the case.
Quality is guaranteed via Behavior Driven Development - BDD. Jest is employed for tests. To test, run:
yarn test
The core has a simple logging system, which writes info to src/logs/info.log
and errors to src/logs/error.log
.
index > middleware > router > controller > service
GitHub actions automatically run tests for Pull Requests - PRs, and code pushes. View the Actions tab in GitHub.
There's an API collection request in /src/utils/core_api.insomnia.json
. You can import and test it Insomnia.