ecosystem

Utils-App

A general framework for creating typescript applications.

Configuration

A set of default options are provided to every instance of App.

--log-level <level>                     Set log level (choices: "debug", "info", "warn", "error", "silent", default: "debug", env: LOG_LEVEL)
--admin-enabled                         Enable admin API server (default: false, env: ADMIN_ENABLED)
--admin-port <port>                     Port for admin API (default: "9000", env: ADMIN_PORT)
--metrics-enabled                       Enable metrics collection (default: false, env: METRICS_ENABLED)
--metrics-port <port>                   Port for metrics server (default: "7300", env: METRICS_PORT)

Lifecycle

The application lifecycle follows

  1. preMain(): validate options and admin api registration prior to running app
  2. main(): implementation of app logic
  3. shutdown() : triggered on interruption or executed after the return of main
    • This MUST cause the resolution of the main promise in order for graceful shutdown. After the 5th interruption, the process is forcefully exited.