MagicMirror² v2.13.0 is available! For more information about this release, check out this topic.

expressApp.get - Error Cannot GET ...

  • Project Sponsor


    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: ' +;
    		var self = this;
    		// Updateinterval ändern über Aufruf
    		this.expressApp.get('/' + + '/changeUpdateInterval', function (req, res) {
    			res.send('Change UpdateInterval from '+ myUpdateInterval);
    		// Kalibrierung anzeigen über Aufruf
    		this.expressApp.get('/' + + '/setCalibration', function (req, res) {
    			res.send('set Calibration');
    			valueListNHCaravanPiPosition[0]["cal"] = 1;
    		// Kalibrierung löschen über Aufruf
    		this.expressApp.get('/' + + '/unsetCalibration', function (req, res) {
    			res.send('unset Calibration');
    			valueListNHCaravanPiPosition[0]["cal"] = 0;

    The call of works as desired.

    The calls of 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


  • @spitzlbergerj said in expressApp.get - Error Cannot GET ...:


    where is expressApp set?

    typically it is

    const app = express()
      // setup the pattern you listen for
      app.get(url_pattern, (req,res) => {})

  • Project Sponsor

    Hi Sam,
    yes, I had always asked myself that, but I am still a Javascript Newby. I got the code from a forum post. After it worked with the first pattern, I thought, that’s because of my low JavaScript knowledge.

    I have now changed it with your help. And now it works.

    Thank you very much!

Log in to reply