How to use the node-red.nodes 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
nodesDir : '../nodes',
            flowFile : 'node-red-flows.json',
            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);
    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 open-rpa / openflow / OpenFlowNodeRED / src / nodered / nodes / api_nodes.ts View on Github external
constructor(public config: Iapi_get_jwt) {
        RED.nodes.createNode(this, config);
        this.node = this;
        this.node.status({});
        if (this.node.credentials && this.node.credentials.hasOwnProperty("username")) {
            this.username = this.node.credentials.username;
        }
        if (this.node.credentials && this.node.credentials.hasOwnProperty("password")) {
            this.password = this.node.credentials.password;
        }
    }
}
github sakazuki / aws-serverless-node-red / lambda.js View on Github external
return new Promise((resolve, reject) => {
      if (reloadFlow) {
        RED.nodes.loadFlows().then(() => { resolve() });
      }else{
        resolve();
      }
    });
  });
github Streampunk / dynamorse-deprecated / server.js View on Github external
nodeAPI.putResource(pipelines).then(function () {
    RED.log.info('Devices and self registred with ledger.');

    RED.nodes.updateFlow('global', {
      configs: [ {
        id: deviceNodeID,
        type: 'device',
        nmos_id: device.id,
        version: device.version,
        nmos_label: device.label,
        nmos_type: device.type,
        node_id: device.node_id,
        node_ref: selfNodeID
      }, {
        id: pipelinesNodeID,
        type: 'device',
        nmos_id: pipelines.id,
        version: pipelines.version,
        nmos_label: pipelines.label,
        nmos_type: pipelines.type,
github open-rpa / openflow / OpenFlowNodeRED / src / nodered / nodes / amqp_nodes.ts View on Github external
constructor(public config: Iamqp_consumer_node) {
        RED.nodes.createNode(this, config);
        try {
            this.node = this;
            this.node.status({});
            this.node.on("close", this.onclose);
            var _config: amqp_connection = RED.nodes.getNode(this.config.config);
            let username: string = null;
            let password: string = null;
            if (!NoderedUtil.IsNullUndefinded(_config) && !NoderedUtil.IsNullEmpty(_config.username)) {
                username = _config.username;
            }
            if (!NoderedUtil.IsNullUndefinded(_config) && !NoderedUtil.IsNullEmpty(_config.password)) {
                password = _config.password;
            }
            if (!NoderedUtil.IsNullUndefinded(_config) && !NoderedUtil.IsNullEmpty(_config.host)) {
                this.host = _config.host;
            }
github open-rpa / openflow / OpenFlowNodeRED / src / nodered / nodes / workflow_nodes.ts View on Github external
constructor(public config: Iworkflow_out_node) {
        RED.nodes.createNode(this, config);
        this.node = this;
        this.node.status({});
        this.node.on("input", this.oninput);
        this.node.on("close", this.onclose);

    }
    async oninput(msg: any) {
github open-rpa / openflow / OpenFlowNodeRED / src / nodered / nodes / amqp_nodes.ts View on Github external
constructor(public config: Iamqp_consumer_node) {
        RED.nodes.createNode(this, config);
        try {
            this.node = this;
            this.node.status({});
            this.node.on("close", this.onclose);
            var _config: amqp_connection = RED.nodes.getNode(this.config.config);
            let username: string = null;
            let password: string = null;
            if (!NoderedUtil.IsNullUndefinded(_config) && !NoderedUtil.IsNullEmpty(_config.username)) {
                username = _config.username;
            }
            if (!NoderedUtil.IsNullUndefinded(_config) && !NoderedUtil.IsNullEmpty(_config.password)) {
                password = _config.password;
            }
            if (!NoderedUtil.IsNullUndefinded(_config) && !NoderedUtil.IsNullEmpty(_config.host)) {
                this.host = _config.host;
            }
            if (!NoderedUtil.IsNullEmpty(username) && !NoderedUtil.IsNullEmpty(password)) {
                this.host = "amqp://" + username + ":" + password + "@" + this.host;
            } else {
                this.host = "amqp://" + this.host;
            }
github open-rpa / openflow / OpenFlowNodeRED / src / nodered / nodes / api_nodes.ts View on Github external
constructor(public config: Igrant_permission) {
        RED.nodes.createNode(this, config);
        this.node = this;
        this.node.on("input", this.oninput);
        this.node.on("close", this.onclose);
    }
    async oninput(msg: any) {
github open-rpa / openflow / OpenFlowNodeRED / src / nodered / nodes / rpa_nodes.ts View on Github external
constructor(public config: Irpa_detector_node) {
        RED.nodes.createNode(this, config);
        try {
            this.node = this;
            this.node.status({});
            this.node.on("close", this.onclose);
            this.host = Config.amqp_url;
            this.connect();
        } catch (error) {
            NoderedUtil.HandleError(this, error);
        }
    }
    async connect() {
github open-rpa / openflow / OpenFlowNodeRED / src / nodered / nodes / onesignal_nodes.ts View on Github external
constructor(public config: Icreate_notification) {
        RED.nodes.createNode(this, config);
        try {
            this.node = this;
            this.node.status({});
            var _config: onesignal_credentials = RED.nodes.getNode(this.config.config);
            if (!NoderedUtil.IsNullUndefinded(_config) && !NoderedUtil.IsNullEmpty(_config.restKey)) {
                this.restKey = _config.restKey;
            }
            if (!NoderedUtil.IsNullUndefinded(_config) && !NoderedUtil.IsNullEmpty(_config.appID)) {
                this.appID = _config.appID;
            }
            this.node.on("input", this.oninput);
            this.node.on("close", this.onclose);
        } catch (error) {
            NoderedUtil.HandleError(this, error);
        }
    }
    async oninput(msg: any) {