Skip to content

infinitaslearning/systemic-ts-service-runner

Repository files navigation

systemic-ts-service-runner

Runs systemic-ts systems

TL;DR

import { systemic } from 'systemic-ts';
import { runner } from 'systemic-ts-service-runner';

const system = systemic()
  .add('config', initConfig(), { scoped: true })
  .add('logger', initLogger()).dependsOn('config')
  .add('service', initService()).dependsOn('config', 'logger');

runner(system).start();

Installation

npm install systemic-ts-service-runner

Usage

import { runner } from 'systemic-ts-service-runner';
import system from './system';
import emergencyLogger from './emergencyLogger';

runner(system, { logger: emergencyLogger }).start().then(components => {
    // Do something with the components
});

or with top level await:

import { runner } from 'systemic-ts-service-runner';
import system from './system';
import emergencyLogger from './emergencyLogger';

const components = await runner(system, { logger: emergencyLogger }).start();
// Do something with the components