Parallel Boot Phase
Parallel boot phase when booting an application.
Installation
$ npm install parallel-boot-phase
Usage
var parallel = ;
parallel( ...fcns )
Creates a parallel boot phase based on provided input functions
.
{// Do something...;}{// Do something else...process;}var phase = ;
A function array
is also accepted.
var phase = ;
Notes
- The phase is considered complete when all
functions
have successfully returned. - If a
function
errors or provides anerror
argument to thenext
callback, the phase aborts and causes the boot sequence to fail.
Examples
var express =bootable =parallel = ;var phase boot app;// Mock connecting to a database...{console;;{console;localsdb1 ='beep': 'boop';;}}// Mock connecting to a different database...{console;;{console;localsdb2 ='bop': 'bip';;}}// Callback invoked once an application boots...{if errorthrow error;console;}// Create a new application:app = ;// Create a boot phase:phase = ;// Create a boot function:boot = ;// Register the phase:boot;// Boot the application:;
To run the example code from the top-level application directory,
$ DEBUG=* node ./examples/index.js
See Also
Tests
Unit
Unit tests use the Mocha test framework with Chai assertions. To run the tests, execute the following command in the top-level application directory:
$ make test
All new feature development should have corresponding unit tests to validate correct functionality.
Test Coverage
This repository uses Istanbul as its code coverage tool. To generate a test coverage report, execute the following command in the top-level application directory:
$ make test-cov
Istanbul creates a ./reports/coverage
directory. To access an HTML version of the report,
$ make view-cov
License
Copyright
Copyright © 2015. Athan Reines.