I use the following code on a desktop computer as well as on an ESP8266 (2v04).
function getTime() { require("http").get("http://worldtimeapi.org/api/timezone/America/Toronto", function (res) { res.on('data', function (data) { console.log(data); console.log(JSON.parse(data).datetime); }); res.on('close', function (data) { console.log("Connection closed"); }); }); } getTime();
node.js on the desktop could parse the output just fine :
<Buffer 7b 22 77 65 65 6b 5f 6e 75 6d 62 65 72 22 3a 35 30 2c 22 75 74 63 5f 6f 66 66 73 65 74 22 3a 22 2d 30 35 3a 30 30 22 2c 22 75 74 63 5f 64 61 74 65 74 ... > 2019-12-15T12:50:08.336992-05:00
ESP8266 shows the following:
1 Attachment
@user106712 started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I use the following code on a desktop computer as well as on an ESP8266 (2v04).
node.js on the desktop could parse the output just fine :
ESP8266 shows the following:
1 Attachment