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 trialNadeem Ahmed
10,125 Points404, 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";
console.log(message);
}
//Connect to API URL (https://teamtreehouse.com/username.json)
var request = https.get("https://teamtreehouse.com/" + username +".json", function(response){
console.log(response.statusCode);
//Read the data
response.on('data', function(chunk) {
console.log('BODY:' + chunk);
});
//Parse the data
//Print the data
});
request.on("error", function(error){
console.error(error.message);
});
1 Answer
Jesus Mendoza
23,289 PointsHey Nadeem,
That happens because that's not your username. It should be: nadeemahmed2!
Nadeem Ahmed
10,125 PointsNadeem Ahmed
10,125 PointsThank you very much Jesus, such a simple mistake