events-analytics

1.0.0 • Public • Published

ArborKnot Client API

ArborKnot Event API, see legacy RCG API.

Getting Started

Install:

Open a terminal and run:

git@github.com:Arborknot/Event-Analytics.git
cd Event-Analytics 
cp .env.example .env
nvm use # or enable auto switch https://github.com/nvm-sh/nvm#automatically-call-nvm-use
npm install
npm run start:db # if you use local db
npm run start:watch

Running tests

npm run start:db
npm run test # will use postgresql://postgres@localhost:5440/postgres
# or use IDE, e.g. vscode has https://marketplace.visualstudio.com/items?itemName=firsttris.vscode-jest-runner

Scripts

  • npm run test: run all tests once
  • npm run build: build project once
  • npm run build:watch: build project when a change is detected
  • npm run start: build and run server
  • npm run start:db: start local databse
  • npm run start:nodemon: restart server when a change is detected
  • npm run start:watch: build and restart server when a change is detected
  • npm run build && npm start: build and restart server when a change is detected

Environment Variables

The following table contains full list of used environment variables:

Var Description Default Example
LOG_LEVEL Logging level, can be: error, warn, info, http, verbose, debug or silly info See default
PORT Server port 4000 See default
DB_HOST DB's host localhost See default
DB_PORT DB's port 5432 See default
DB_NAME DB's name postgres See default
DB_USER DB's user postgres See default
DB_PASS DB's password postgres See default
DB_MIN_CONNECTIONS_ALLOWED DB's min connections in pool node-postgres defaults 1
DB_MAX_CONNECTIONS_ALLOWED DB's max connections in pool postgres 10
DB_IDLE_IN_TRANSACTION_SESSION_TIMEOUT_MILLIS DB's number of milliseconds before terminating any session with an open idle transaction no timeout 1000
DB_CONNECTION_TIMEOUT_MILLIS DB's number of milliseconds to wait for connection no timeout 1000
DB_IDLE_TIMEOUT_MILLIS DB's number of milliseconds to wait for idle clients 1000 See default

| SENDGRID_API_KEY | SendGrid API key | None | SG.XHs10LLSFu_5CS3EiZQ7Q.4GRFquO7kvPoy08C8ylcUhxkhY7TyrZyh6L50MH-Pu2 | | TWILIO_ACCOUNT_SID | Twilio accound SID | _None | ACdb3d110bcc827e8ddccd4bd3000a0487 | | TWILIO_ACCOUNT_TOKEN | Twilio account token | None | 4e63637d20d0e2178d9971ff16a383d4 | | TWILIO_MESSAGING_SERVICE_SID | Twilio messaging service sid | None | MGb627696lazad1ecfec5e9d4b59e59c92 |

Note: .env.example can be used as a reference too.

redis : docker run -p 6379:6379 redis you need to run redis and ioredis : version: '3'

services: redis: image: 'bitnami/redis:latest' environment: - ALLOW_EMPTY_PASSWORD=yes ports: - '6379:6379'

networks:

- app-tier

redis-sentinel: image: 'bitnami/redis-sentinel:latest' environment: - REDIS_MASTER_HOST=localhost - REDIS_PASSWORD=password - REDIS_MASTER_PASSWORD=password ports: - '26379:26379'

networks:

- app-tier

redis-commander: container_name: redis-commander hostname: redis-commander image: rediscommander/redis-commander:latest restart: always environment: - REDIS_HOSTS=localhost:6379 - REDIS_PASSWORD=password ports: - "8081:8081"

networks:

- app-tier

unit test: Create unit test with typescript : https://www.npmjs.com/package/ts-jest

db connection : Db connection : https://app.gitbook.com/o/-MSX5vtAAOdF7S4zifFt/s/-Mgl2Fw86qmgFeKwzqhS/devops/manuals/db-connections#staging

Readme

Keywords

none

Package Sidebar

Install

npm i events-analytics

Weekly Downloads

0

Version

1.0.0

License

ISC

Unpacked Size

88.3 kB

Total Files

39

Last publish

Collaborators

  • asafamir