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

Diego ROJAS
Diego ROJAS
1,780 Points

I'm stuck on this exercise I don't understand

I don't know how to store the result of the get method!

help

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

https.get("https://teamtreehouse.com/chalkers.json", (response) => {

});

1 Answer

Gabbie Metheny
Gabbie Metheny
32,987 Points

The instructions just ask you to store the results of the get method in a variable request, which just means you need to create a variable called request with const or let and assign the https.get call to it! By storing it, you'll be able to access it for the additional tasks of the challenge by calling request.<someMethod>. Let me know if you're still having trouble!

Diego ROJAS
Diego ROJAS
1,780 Points

For some reason some part of the snippet weren' loading correctly as I tried many times to store a const as a new https get request.

I missed one line of code which logged the statusCode out. (That's the one which didn't load)

Anyways thanks for taking the time to answer me :D I'll give you best answer dw

Gabbie Metheny
Gabbie Metheny
32,987 Points

No worries, I'm glad you figured that out!

You can always hit "Restart" on a challenge if you suspect you deleted a line of code that you need, or just have gotten a little lost :)