How to use the node-red.start function in node-red

To help you get started, we’ve selected a few node-red examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github EdgeVerve / loopback-connector-nodes-for-Node-RED / node-red.js View on Github external
// Serve the http nodes UI from /api
    app.use(settings.httpNodeRoot, RED.httpNode);
    var adminApp = RED.httpAdmin;
    var redNodes = RED.nodes;
    
    if (!options.settings.server) {
        
        var port = options ? options.port || 3001 : 3001;
        server.listen(port);
        RED.start().then(function () {
            return callback();
        });
    }
    else {
        // Start the runtime - removing earlier timeout implementation!!
        RED.start().then(function () {
            return callback();
        }).otherwise(function (err) {
            console.log('**ERROR : NODE RED WAS NOT STARTED ***' , err);
        });
    }
}
github Streampunk / dynamorse-deprecated / server.js View on Github external
logging: { console : { level : "error", audit : false } }
};

// Initialise the runtime with a server and settings
RED.init(server,settings);

// Serve the editor UI from /red
app.use(settings.httpAdminRoot, RED.httpAdmin);

// Serve the http nodes UI from /api
app.use(settings.httpNodeRoot, RED.httpNode);

server.listen(+properties.redPort);

// Start the runtime - function can be used to do work after types are loaded
RED.start().then(function () {
  RED.log.info("STARTED!");
});

// Run flow configurations once flows are loaded
var EE = require('events').EventEmitter;
var logger = new EE();
RED.log.addHandler(logger);
logger.on('log', function (x) { if (x.msg === 'Starting flows') {
  RED.settings.functionGlobalContext.updated = false;
  // logger.removeAllListeners();
  nodeAPI.putResource(device).catch(RED.log.error);
  nodeAPI.putResource(pipelines).then(function () {
    RED.log.info('Devices and self registred with ledger.');

    RED.nodes.updateFlow('global', {
      configs: [ {
github samtecspg / conveyor / api / plugins / startup-install.plugin.js View on Github external
functionGlobalContext: {}    // enables global context
    };

    // Initialise the runtime with a server and settings
    RED.init(server, settings);

    // Serve the editor UI from /red
    app.use(settings.httpAdminRoot, RED.httpAdmin);

    // Serve the http nodes UI from /api
    app.use(settings.httpNodeRoot, RED.httpNode);

    server.listen(1880);

    // Start the runtime
    RED.start().then(EmbeddedStart(RED)).then((result) => {

        // result is whatever RED.start() resolved to
        // RED.node.getFlows() etc are now ready to use

        //Still calls a little bit too fast so adding a delay.
        setTimeout(() => {

            callback(null);
        }, 1000 * 5);

    }).catch((err) => {

        if (/^timed out/.test(err.message)) {
            // embeddedStart() timed out
            // the value that RED.start() resolved to is available as err.result
        }
github IBM-Blockchain / vehicle-manufacture / apps / manufacturer / server / src / server.ts View on Github external
httpAdminRoot: '/node-red',
        httpNodeRoot: '/node-red/api',
    };

    RED.init(server, nodeRedSettings);

    app.use(nodeRedSettings.httpAdminRoot, RED.httpAdmin);
    app.use(nodeRedSettings.httpNodeRoot, RED.httpNode);

    await setup(app, SERVER_CONFIG);

    server.listen(port, () => {
        console.log(`Server started on port ${port}`);
    });

    RED.start();
}
github sakazuki / node-red-desktop / src / main / node-red.ts View on Github external
public async startRED() {
    this.server.close();
    try {
      await RED.start();
      this.server.listen(this.listenPort, this.listenIp, () => {
        ipcMain.emit("browser:go", this.getAdminUrl());
      });
    } catch (err) {
      log.error(err);
    }
  }
github bigclownlabs / bch-playground / src / background / NodeREDWorker.js View on Github external
copyFolderRecursiveSync(source, target);
                                    }
                                }
                            }
                        }
                    }
                }
            };

            let http_app = express();
            let server = http.createServer(http_app);
            RED.init(server, settings);
            http_app.use(settings.httpAdminRoot, RED.httpAdmin);
            http_app.use(settings.httpNodeRoot, RED.httpNode);

            RED.start().then(function () {
                server.listen(listenPort, "127.0.0.1", ()=>{
                    status = "online";

                    resolve();
                });
            });
        } else {
            status = "external";

            reject();
        }
    });
}