This suite of components provides the common objects typically needed by any Node.js application, including settings that can be tuned via configuration files and logging facilities for informational and error messages.
$ npm install bixby-common
To utilize Bixby.js' common suite of components, register them with the IoC container.
IoC.use(require('bixby-common'));
exports['@require'] = [ 'entity' ];
The entity component provides a way to identify the application itself, including any optional aliases. This is typically utilized for security-related purposes where stable identifiers are crucial.
This component will read settings within the [entity]
section.
{string} [id]
- application identifier{string[]} [aliases]
- additional application aliases
[entity]
id = "https://api.example.com/beepboop/v1"
aliases = [ "@api.example.com", "https://api.example.com/bebop/" ]
exports['@require'] = [ 'logger' ];
The logger component provides a logger, powered by winston
.
Log transports and related options are configurable within the application's
configuration file.
This component will read settings within the [logger]
section.
{string} [level]
- logging level{string|string[]} [transport]
- log transports{string} [path]
- path to log file
By default, the logger will use both "console" and "file" transports, with the following paths for log files:
- Linux:
/var/log/<package-name>.log
- Mac OS X:
~/Library/Logs/<package-name>.log
[logger]
level = "debug"
transport = "console"
[logger]
transport = "file"
path = "/var/log/app.log"
exports['@require'] = [ 'notifications' ];
The notifications component provides a shared notification center, powered by
notifications
. This is
useful for broadcasting events within a process, allowing communication between
fully decoupled subsystems.
exports['@require'] = [ 'settings' ];
The settings component provides a mechanism to configure an application via
configuration files, powered by the decisions
module. Configuration is preferably loaded from TOML
files, though YAML and JSON are
supported as well.
$ make test
Copyright (c) 2014 Jared Hanson <http://www.jaredhanson.net/>