I Anforderungsmodul hinzugefügt und Änderungen gemäß der Dokumentation in Haupt settings.js gemacht habe Zugriff auf:kann nicht get-Methode von Anfrage-Paket in dem Funktionsknoten
// Anything in this hash is globally available to all functions.
// It is accessed as context.global.
// eg:
// functionGlobalContext: { os:require('os') }
// can be accessed in a function block as:
// context.global.os
functionGlobalContext: {
requestModule:require('request').defaults({jar: true})
// os:require('os'),
// octalbonescript:require('octalbonescript'),
// jfive:require("johnny-five"),
// j5board:require("johnny-five").Board({repl:false})
},
Dies ist der Code in einen meines Funktionsknoten ist :
var request = context.global.requestModule;
request.get('http://192.168.0.44:3000' + '/api/stats',
function (err, data) {
if (err) {
console.log("could not process data");
}
else {
var body = JSON.parse(data.body);
msg.payload = body.deviceCount;
}
});
return msg;
Mein Knoten rot-Version (0.16.2)
Warum brauchen Sie das Anfrage-Modul dafür? Der HTTP-Request-Knoten wird gut funktionieren – hardillb
Ich brauche einige zusätzliche Authentifizierungsprozess mit jeder Datenzugriffsanfrage, die nicht in der Standard-HTTP-Anfrage Knoten –