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 trialmark anderson
Courses Plus Student 1,279 PointsCan't figure out the question or answer...
I've tried to take 'my' code out and put in the template code... nothing seems to work. Any ideas?
//Problem: We need a simple way to look at a user's badge count and JavaScript points
//Solution: Use node.js to connect to TreeHouse API to get profile information to print out
var http = require("http");
//var username = "markanderson6";
var username = "chalkers";
function printMessage(username, badgeCount, points) {
var message = username + " has " + badgeCount + " total badge(s) and " + points + " points in JavaScript";
console.log(message);
}
//Connect to the API URL ("http://teamtreehouse.com/username.json")
//var request = http.get("http://teamtreehouse.com/" + username + ".json", function(response){
var request = http.get("http://www.msn.com", function(response){
console.log(response.statusCode);
//Read the data
//Parse the data
//Print the data
});
mark anderson
Courses Plus Student 1,279 PointsNode.js basics... lesson 1/4 "Require Node.js' http module and assign it to the variable http."
Umesh Ravji
42,386 Pointsvar http = require('http');
Is That what you are looking for, is that the problem you had?
mark anderson
Courses Plus Student 1,279 PointsI just switched it to HTTPS and it worked !! ?? Why?????
Umesh Ravji
42,386 PointsMine accepts http and won't accept https, I'm not sure why yours would be the other way around :)
1 Answer
Seth Kroger
56,414 PointsThis challenge will go better is you don't cut-and-paste what you did in Workspaces for the video and just type in the answers for each step as you go. In particular it's asking you get a specific URL.
Umesh Ravji
42,386 PointsUmesh Ravji
42,386 PointsHi Mark, which challenge are you on and which step is the problem? I cannot seem to match your template code to the challenge you have linked.