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 trialDamian McCarthy
3,656 PointsI dont understand this one at all, how do I put this into a callback function.
I am not sure how to do this, I am not sure how to place this in a callback function.
const https = require('https');
https.get('https://teamtreehouse.com/chalkers.json')
1 Answer
Steven Parker
231,269 PointsYou may have misunderstood the instructions. They say, "Now, in the https.get() call pass in an anonymous function as a callback with the parameter of response. This function is the second parameter in the get call."
So you're not being asked to put the current code into a callback function, they want you to create a callback function as an additional parameter of the call:
https.get('https://teamtreehouse.com/chalkers.json', /* your new callback goes here */)
Damian McCarthy
3,656 PointsDamian McCarthy
3,656 PointsThat is what I initially thought, and I attempted this :
but that comes back as that there is no https.get request.
Steven Parker
231,269 PointsSteven Parker
231,269 PointsYou nearly had it there. You just have the closing parenthesis in the wrong place:
Damian McCarthy
3,656 PointsDamian McCarthy
3,656 PointsOhh wow thanks.