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

Nadeem Ahmed
Nadeem Ahmed
10,125 Points

404, Body not found error

I keep on getting a 404 and Body not found error. Copy of my code is below can someone help?

//Problem: simple way to look at user's badge count and Javascript points
//Solution: Use Node.js to connect to Treehouse's API to get profile info to print out
var https = require("https");
var username = "Nadeem";

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

//Connect to API URL (http://teamtreehouse.com/username.json)
var request = https.get("https://teamtreehouse.com/" + username +".json", function(response){
     //Read the data
  response.on('data', function(chunk) {
    console.log('BODY:' + chunk);
     //Parse the data
     //Print the data                 

request.on("error", function(error){

1 Answer

Jesus Mendoza
Jesus Mendoza
23,274 Points

Hey Nadeem,

That happens because that's not your username. It should be: nadeemahmed2!

Nadeem Ahmed
Nadeem Ahmed
10,125 Points

Thank you very much Jesus, such a simple mistake