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 trialBrian Wang
1,766 PointsHow do I call the get method on https?
Do i have to initiate another variable like request then call get on https?
const https = require('https');
https.get(`https://teamtreehouse.com/chalkers.json` , response => {
console.log(response.statusCode);
});
2 Answers
Peter Quin
3,203 PointsYou are missing brackets around the functions argument (response).
https.get('https://teamtreehouse.com/chalkers.json' , (response) => {
console.log(response.statusCode);
});
I am also unsure if the use of the ` instead of " or ' has any effect. I would stick with ' ' or " " as you are not using any dynamic content in the string. I am unsure though so maybe someone else could clarify that?
barnetobeka
Courses Plus Student 10,895 PointsThats right but backticks are mainly used when you have variables in the string
suchas if you replace chalkers with a variable maybe ${userName} since lets say you want to access other
usernames even yours.