(all credit to this source) for this coverage report:
Statements | Branches | Functions | Lines | Built By |
---|---|---|---|---|
- This was written on an Ubuntu 20.04 (PopOS 20.04 LTS) based machine
- Install/run scripts will work in bash shells running on Debian-like/MacOS machines
- They will likely not run on Windows (my apologies!)
- JS as supported by node 12.16.3
- Testing with Jest + Supertest
- ORM with Sequelize
- Persistent store: Postgres 12 (running in Docker)
- Node (tested with v12.16.3)
- Express.js
- Docker (tested with v19.03.12, build 48a66213fe)
- If you're on a Debian machine and Docker is not installed on your machine, a helper script (
./bin/install_docker.sh
) is included- All Docker commands in subsequent scripts assuming your user is added to a 'docker' group - i.e. you can run
docker
commands without asudo
prefix - If you're on MacOS and Docker has been installed via a .dmg, you should be okay
- All Docker commands in subsequent scripts assuming your user is added to a 'docker' group - i.e. you can run
$ npm i
Start Postgres in docker, run the sequelize migration and add custom relation constraints with:
$ npm run seed
With the current implementation, some tests run against a up-and-running local database
$ npm run seed && npm run test
Without nodemon:
$ npm run start
With nodemon:
$ npm run watch
helpers/
- shared utilities
paths/
- Simple config for the Express.js router
providers/
- At present, only higher order functions + destinations for alerting functions
server/
- (A lot of boilerplace generated by the sequelize-cli) and:
controllers
- Modules that funnel requests and orchestrate model data
For Part three: threshold alerts
, email alerts are supported given a top level .env with the following smtp configuration is supplied:
- e.g.
./.env
might look like :
ALERTER_EMAIL_HOST="smtp.your.host.com"
ALERTER_EMAIL_PORT=587
ALERTER_EMAIL_USER="[email protected]"
ALERTER_EMAIL_PW="keep_it_safe"
- the
.env
variables are only picked up ifprocess.env.NODE_ENV === 'development'
- In all other cases, generic details from ethereal.email are used