Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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

Diego ROJAS
Diego ROJAS
1,781 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
33,778 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,781 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
33,778 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 :)