• Wilberforce
    Can you post your code?

    I've found what is the source of problem. If you don't put callback function (as in example below) into POST handler your memory usage increases with every POST request and program after a while crashed. With such callback everything works now, I think :)

    // This handles any received data from the POST request
    function handlePOST(req, callback) {
      var data = "";
      req.on('data', function(d) { data += d; });
      req.on('end', function() {
        // All data received from the client, so handle the url encoded data we got
        // If we used 'close' then the HTTP request would have been closed and we
        // would be unable to send the result page.
        postData = {};
        data.split("&").forEach(function(el) {
          var els = el.split("=");
          postData[els[0]] = decodeURIComponent(els[1]);
        });
        // finally our data is in postData
        console.log(postData);
        // do stuff with it!
        console.log("We got sent the text ", postData.mytext);
        digitalWrite(LED1, postData.led1);
        digitalWrite(LED2, postData.led2);
        // call our callback (to send the HTML result)
        callback();
      });
    }
    
About

Avatar for Wilberforce @Wilberforce started