Nondeterministic Postrequisite Metaprotocol
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    koars-utilspublic

    koars-utils

    Build Status

    This package provides several utility functions for the koars framework and its dependencies.

    Setup

    The module exports a single function:

    var utils = require('koars-utils')(logOptions);
    

    logOptions is an optional argument.

    utils.name()

    Returns the name of your program as set in the NAME environment variable. Defaults to koars.

    utils.port()

    Returns the port of your program as set in the PORT environment variable. Defaults to 3000.

    utils.basepath()

    Returns the basepath of your program as set in the BASEPATH environment variable. Defaults to an empty string.

    utils.dev()

    Returns a boolean exclaiming if your program is running in development mode. Defaults to true if the NODE_ENV environment variable is set to anything but production. If NODE_ENV is set to test, the NODE_ENV_TEST variable ist used.

    utils.test()

    Returns true if NODE_ENV is set to test, false otherwise.

    utils.log

    Assigned a bunyan logger. This is either a global logger if the module was called without arguments, or a childlogger of said global logger created via:

    logger.child(logOptions);
    

    If utils.test() returns true, all loggers will dump their output.

    utils.config

    An instance of koars-config instantiated to the directory passed in the CONFIG environment variable (defaults to config). This is also run through koars-defaults to assign sane defaults for our application.

    utils.hbs

    An instance of handlebars, to prevent requiring different versions from different submodules.

    Keywords

    install

    npm i koars-utils

    Downloadsweekly downloads

    1

    version

    1.5.0

    license

    BSD-3-Clause

    repository

    github.com

    last publish

    collaborators

    • avatar