0.1.7 • Published 10 months ago

bootman v0.1.7

Weekly downloads
22
License
MIT
Repository
github
Last release
10 months ago

Bootman

Start and stop services dependent on one another in order

Usage

1. Define Individual Services

// services/d.js
export default {
  dependsOn: ['a', 'b', 'c'], // Services which must be started prior to this service
  start: () => {}, // Start up function, called when this service is started
  stop: () => {} // Teardown function, called when this service is stopped
};

2. Initialize Bootman with Defined Services

// services/index.js
import { createServiceController } from 'bootman';
import a from 'services/a.js';
import b from 'services/b.js';
import c from 'services/c.js';
import d from 'services/d.js';

export default createServiceController({ a, b, c, d });

3. Start or Stop Services

Start
import services from 'services/index.js';

export default services.start(['d']);

/*
  In this particular example, since service d dependsOn services a, b, and c,
  all three of those services must be in a "started" state before service d
  will be started.

  The .start and .stop functions accepts either an individual name, i.e. 'd'
  or an array of names, i.e. ['d', 'c', 'b', 'a'].
*/
Stop
// Stop a service
import services from 'services/index.js';

export default services.stop(['d']);
0.1.7

10 months ago

0.1.6

10 months ago

0.1.4

4 years ago

0.1.5

4 years ago

0.1.3

4 years ago

0.1.2

5 years ago

0.1.1

6 years ago

0.1.0

6 years ago