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 Building a Command Line Application Making a GET Request with https

rajan lagah
rajan lagah
2,539 Points

On a new line, call the get method on the https object you created. Pass in the string of https://teamtreehouse.com/chal

why is it wrong https.get(--string--);

app.js
const https=require('https');
const req=https.get(`https://teamtreehouse.com/chalkers.json.`,response=>{});

1 Answer

Stephan Olsen
Stephan Olsen
6,650 Points

Be careful with creating unneccesary variables when doing challenges, as it may you may sometimes not pass the challenge because of it. With that being said let's see some of the things that's wrong here.

  1. You should not be saving the https.get() in a variable called req.
  2. You should only use single or double apostrophes for strings, not backticks as you've done in your case. Either "" or ''
  3. As your second parameter your making an arrow function named response, you should be making an anonymous function with a parameter called response
// Anonymous function
function(parameter) { }

The guy in the tutorial also used backticks