You are reading a single comment by @DrAzzy and its replies.
Click here to read the full conversation.
-
function onPageRequest(req, res) { res.writeHead(200, {'Content-Type':'text/html'}); res.write('Hello'); res.end(''); } var wifi = require("Wifi"); E.on('init',function () { require("http").createServer(onPageRequest).listen(80); console.log("APIp="+wifi.getAPIP().ip); console.log("StationIP="+wifi.getIP().ip); });
Note that that won't work immediately after uploading, only after save(), since the initialization takes place in the init callback. It's often not practical to make code that works both after direct upload and after save() and restart.
Hello!
This code works. (V1.91)
function onPageRequest(req, res) {
res.writeHead(200, {'Content-Type':'text/html'});
res.write('Hello');
res.end('');
}
require("http").createServer(onPageRequest).listen(80);
var wifi = require("Wifi");
console.log("APIp="+wifi.getAPIP().ip);
console.log("StationIP="+wifi.getIP().ip);
After the command "Save();" code is not working.
Why?