JavaScript Node.js Basics Handling Errors in Node Handling Errors in Node

Macci Macaranas
Macci Macaranas
5,169 Points

Need help: Create a variable request that stores the result of the get method.

I don't know how this can be wrong.

app.js
const https = require("https");

https.get("https://teamtreehouse.com/chalkers.json", response => {
  console.log(response.statusCode);
  var request = "";

  response.on("data",data=>{
    request += data.toString()
  })

});

1 Answer