redwire-harmony

2.1.2 • Public • Published

Harmony

Daemon for redwire

Harmony runs a directory full of javascript files as individual redwire instances.

NPM version

Install

npm install -g redwire-harmony

Usage

In a directory with the javascript files you want to run as redwire instances

harmony

To reload any changes send a SIGHUP to the harmony daemon

Example

Save this file into a directory as example.js and run harmony.

module.exports = {
    config: { http: { port: 8888 } },
    bind: function(redwire, bindings) {
        // bindings has http, https, tcp, tls and websocket mounts
        // See documentation for redwire
        bindings
            .http('http://localhost:8888/')
            .use(function(mount, url, req, res, next) {
                res.write('OK');
                res.end();
            });
        bindings
            .http('http://localhost:8888/api')
            .use(function(mount, url, req, res, next) {
                console.log('API CALL');
                next();
            })
            .use(redwire.proxy('http://localhost:9999/api');
    },
    end: function() {
        // clean up any services you are using here
    }
};

Dependencies (2)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i redwire-harmony

    Weekly Downloads

    0

    Version

    2.1.2

    License

    MIT

    Last publish

    Collaborators

    • ajnisbet
    • ascendzor
    • tcoats
    • tornadot-tim