Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript Node.js Basics (2014) Building a Command Line Application Getting the Response Body

Floyd Orr
Floyd Orr
11,723 Points

I get stuff like:app.js:at objecct.Module._extensions..js (module.js:474:10) but no error code. My code is not working?

// Problem: We need a siple way to look at a user's badge count and javascript points
// use node.js to connect to Treehouse's API to get profile information to print out
var http = require("http");
var username ="floydorr";

function printMessage (username, badgeCount, points) {
    var message = username + " has " + badgeCount + " total badge(s) and " + points + " points in Javascript";


//1connect to the API url (http:// teeamtreehouse.com/
var request = http.get("http://teamtreehouse.com/" + username +" .json", function (response) {
  //2read the data
    reponse.on( "data", function (chunk) {
        console.log("BODY: " + chunk);  


//3Parse the data
//4Print the data


2 Answers

17,917 Points


Your code got 2 errors, the first one: 1 - you typed reponse instead of response 2 - unecessary "});"

Clean this and your code should run ok

Floyd Orr
Floyd Orr
11,723 Points

Thank you i got it working 2 days ago