npm install
cp .env.example .env
# Ensure that a PostgreSQL database is running on your localhost
# Start server
npm run start
# Run tests written in ES6
yarn test
# Run test along with code coverage
yarn test:coverage
# Run tests on file change
yarn test:watch
# Lint code with ESLint
yarn lint
# Run lint on any file change
yarn lint:watch
# Wipe out dist and coverage directory
gulp clean
# Default task: Wipes out dist and coverage directory. Compiles using babel.
gulp
# compile to ES5
1. npm run build
# upload dist/ to your server
2. scp -rp dist/ user@dest:/path
# Use any process manager to start your services
4. pm2 start dist/index.js
Universal logging library winston is used for logging. It has support for multiple transports. A transport is essentially a storage device for your logs. Each instance of a winston logger can have multiple transports configured at different levels. For example, one may want error logs to be stored in a persistent remote location (like a database), but all logs output to the console or a local file. We just log to the console for simplicity, you can configure more transports as per your requirement.
Logs detailed info about each api request to console during development.
Logs stacktrace of error to console along with other details. You should ideally store all error messages persistently.
Get code coverage summary on executing yarn test:coverage
yarn test:coverage
also generates HTML code coverage report in coverage/
directory. Open lcov-report/index.html
to view it.
# In `.env` file, assign `UNIQUE_NAME_PG_HOST` to amida-db
1. sed -i s/localhost/amida-db/ .env
# Run:
2. yarn build && docker-compose up
The basic steps for deploying to AWS are:
- Run the Packer script,
template.json
- Run the Terraform script.
Further details can be found in the deploy
directory.