Running Environments

CabloyJS provides three running environments: unit-test environment, local development environment, production environment

Correspondingly, CabloyJS provides four config file, which correspond to the running environment as follows:

Config File Running Environment
config.default.js default config for all environments
config.unittest.js unit-test environment
config.local.js local development environment
config.prod.js production environment

How to start the corresponding running environment?

1. Unit-test Environment

  1. 1# unit-test
  2. 2$ npm run test:backend
  3. 3# code coverage
  4. 4$ npm run cov:backend

2. Local Development Environment

  1. 1$ npm run dev:backend

3. Production Environment

  1. 1# start service
  2. 2$ npm run start:backend
  3. 3# start service (daemon)
  4. 4$ npm run start:backend-daemon
  5. 5# stop service
  6. 6$ npm run stop:backend

How to check the current running environment?

The current running environment can be determined in this way:

  1. 1// unit-test environment
  2. 2app.meta.isTest
  3. 3// local development environment
  4. 4app.meta.isLocal
  5. 5// production environment
  6. 6app.meta.isProd