get data from api in hackerrank\ code example
Example: GET request in hackerrank
var http = require("http");
http.get('URL', (res) => {
res.setEncoding("utf8");
let body = "";
res.on("data", data => {
body += data;
});
res.on("end", () => {
body = JSON.parse(body);
console.log(body);
});
});