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 Getting the Response Body

I dont know what I am missing

I keep getting the error: Bummer: You haven't added the dataChunk to responseBody. But to my understanding, I have done this.

app.js
const https = require("https");
const request = https.get("https://teamtreehouse.com/chalkers.json", response => {
    let responseBody = "";

    response.on("data", dataChunk => {
          responseBody += dataChunck ;
    });

    response.on("", () => {
        console.log(responseBody);
    });

});

request.on("error", error => {
    console.error(error.message);
});

3 Answers

Steven Parker
Steven Parker
231,269 Points

It's just a spelling error, you have "dataChunck" (with an extra "c") instead of "dataChunk".

Mark Casavantes
Mark Casavantes
10,619 Points

I am not sure you can have a constant variable "https". Is https a reserved word? I am not sure.

Steven Parker
Steven Parker
231,269 Points

That's not only OK, it's the "best practice" convention to use that variable name for that module.

Mark Casavantes
Mark Casavantes
10,619 Points

Thank you Steven,

I respect and value your advice.

Thank you,

Mark