1.0.0 • Published 1 year ago

decision-maker v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

Business Logic

The business logic all of the smart algorithms and decisions will be here

Resources

Getting Started

Install:

Open a terminal and run:

git clone git@github.com:Arborknot/business-logic.git
cd business-logic
cp .env.example .env # modify .env
nvm use
npm install
npm run dev

Then go to http://localhost:3000.

Scripts

ScriptDescription
npm run testRun tests
npm run ci-testRun tests in CI mode
npm run buildBuild project
npm run startRun server for production
npm run devRun server for dev
npm run watchRun server for dev in watch mode

Environment Variables

The following table contains full list of used environment variables:

VarDescriptionDefaultExample
PORTServer port3001See default
DB_HOSTDB's hostlocalhostSee default
DB_PORTDB's port5432See default
DB_NAMEDB's namepostgresSee default
DB_SCHEMADB's schemapublicSee default
DB_USERNAMEDB's userpostgres
DB_PASSWORDDB's passwordX
MESSAGE_MANAGER_INTERNAL_ENDPOINTThe endpoint of the message managerXhttp://localhost:3006

Also see (logger's configuration](https://github.com/Arborknot/logger).

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

Runtime Variables

In service config there should be a row named business-logic, the json next to it can contain the following vars

VarDescriptionDefaultExample
LOGGER_LEVELThe level of the loginfoSee default
TEST_MODEWhen true the the service will not send a request to message managerfalseSee default

Tips :bulb:

Automatically nvm use

https://github.com/nvm-sh/nvm#automatically-call-nvm-use

Exposing localhost to other networks

npx ngrok http 3000

Debugging in VSCode

Install nodemon globally with npm install -g nodemon.

Enable auto attach and run npm run dev in VSCode's integrated terminal.

Or in Debug window execute Launch nodemon (client-api) launch script.

Running tests in VSCode

Use Jest runner extension.