Skip to content

Instantly share code, notes, and snippets.

@ruyut
Created March 1, 2020 13:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ruyut/cbd254b88127f435b744e49b828ba568 to your computer and use it in GitHub Desktop.
Save ruyut/cbd254b88127f435b744e49b828ba568 to your computer and use it in GitHub Desktop.
var https = require("https");
var fs = require('fs');
var url = "https://data.ntpc.gov.tw/od/data/api/28AB4122-60E1-4065-98E5-ABCCB69AACA6?$format=json";
https.get(url, function (response) {
var data = "";
console.log("start");
response.on("data", chunk => {
console.log("on data");
data += chunk;
});
response.on("end", () => {
data = JSON.parse(data);
console.log(data);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment