This project should be used as a base to integrate every usefull framework for code quality and security.
We tried to follow https://12factor.net/.
We choose eslint with prettier in fix mode with airbnb famous config.
Configuration is explicitly linked to config/eslintrc.yml
yarn run lint
test
directory contains spec tests.
yarn run test
We choose istanbul with nyc mocha to produce lcov files.
yarn run test-report
Using husky lint and test are run before commit and push to add one level of quality.
Using gitlab-ci we run linter, test and report coverage via sonar-scanner
Configuration is read from environment variable. We use dotenv to facilitate the usage.
You can either run MY_VARIABLE=test node index.js
or set MY_VARIABLE=test
in config/env
file.
Of course this file is ignored by git as it can contain sensitive information. Please be careful to not push any copy of your env file renamed in something else.
We choose winston as logger output in STDOUT with json format in production mode or simple otherwise.
To use the logger, simply add const logger = require('./app/utils/logger');
you can then log using levels
We choose pm2 as it cover a huge list of feature for running processes.
yarn run pm2
give access to pm2.
As a shortcut to common actions :
yarn run start
to start the app
yarn run dev
to start the app with live reload on file modification plus logs viewer.
yarn run logs
to attach to logs