Hi,
I intercept a webservice call via node_helper.js. Now I wanted to handle two more webservice calls. Unfortunately this doesn’t work.
my code:
const NodeHelper = require("node_helper")
var async = require('async');
var exec = require('child_process').exec;
var express = require('express');
var app = express();
...
module.exports = NodeHelper.create({
start: function() {
//console.error('Starting node helper: ' + this.name);
var self = this;
// Updateinterval ändern über Aufruf http://127.0.0.1:8080/MMM-CaravanPiPosition/changeUpdateInterval
this.expressApp.get('/' + this.name + '/changeUpdateInterval', function (req, res) {
res.send('Change UpdateInterval from '+ myUpdateInterval);
self.changeUpdateInterval();
});
// Kalibrierung anzeigen über Aufruf http://127.0.0.1:8080/MMM-CaravanPiPosition/setCalibration
this.expressApp.get('/' + this.name + '/setCalibration', function (req, res) {
res.send('set Calibration');
valueListNHCaravanPiPosition[0]["cal"] = 1;
});
// Kalibrierung löschen über Aufruf http://127.0.0.1:8080/MMM-CaravanPiPosition/unsetCalibration
this.expressApp.get('/' + this.name + '/unsetCalibration', function (req, res) {
res.send('unset Calibration');
valueListNHCaravanPiPosition[0]["cal"] = 0;
});
},
...
The call of http://127.0.0.1:8080/MMM-CaravanPiPosition/changeUpdateInterval works as desired.
The calls of http://127.0.0.1:8080/MMM-CaravanPiPosition/setCalibration and … unsetCalibration does not work.
Instead the error message Cannot GET /MMM-CaravanPiPosition/setCalibration is displayed.
what am i doing wrong? can’t several different webservice calls be processed?
Thanks for every help
Sepp