You are reading a single comment by @tve and its replies. Click here to read the full conversation.
  • I'm not sure what exactly is happening, but it may be that onInit() gets called before the networking code is fully initialized. The following will do what you're looking for:

    var http = require("http");
    
    function server() {
      http.createServer(function (req, res) {
        res.writeHead(200);
        res.end("Hello World");
      }).listen(8080);
    }
    
    function onInit() {
      Serial2.write("onInit\n");
      setTimeout(server, 1000);
    }
    

    The Serial2.write appears on uart1 (as opposed to the normal uart0) where the log messages are. You can remove that, I used it to see when onInit runs.

About

Avatar for tve @tve started