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 trialmichael7williams
9,638 PointsNode won't run app.js
File is saved - here is the code. The console freezes after I execute 'node app.js' in the console.
//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's API to get profile information to print out.
var http = require("http"), user = 'michael7williams';
function printMessage(username, badgeCount, points){
var message = username + ' has ' + badgeCount + ' total badges and ' + points + ' points in JavaScript.';
console.log(message);
}
//Connect to the API URL (https://teamtreehouse.com/username.json)
var request = http.get('http://teamtreehouse.com/' + user + '.json', function(response) {
console.dir(response);
//Read the data
//Parse the data
//Print the data
});
michael7williams
9,638 PointsAgreed - after a few minutes I received a time-out error. Bummer.
George Akinian
17,615 PointsI am having same issue connecting to the api with workspace. If i visit api url it shows profile information. It seams like it maybe an internal issue with workspace since I am able to connect to google api with the app no problem. I wrote them a letter two days ago and have not heard from them. After while I get a time out with the following: node app.js Server running at http:/// events.js:85 throw er; // Unhandled 'error' event ^ Error: connect ETIMEDOUT at exports._errnoException (util.js:746:11) at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1010:19)
what's the deal ?
michael7williams
9,638 PointsYes, it seems to be an internal Work-space issue when communicating with the Treehouse API. Hopefully this gets patched soon. While I love the site, we don't pay a subscription to not be able to use it's resources, let alone communicate with the site's own API. Maybe an internal loop is the issue..
1 Answer
Nathan Williams
Python Web Development Techdegree Student 6,851 PointsHey folks, this is related to some work I did last week to get the workspaces platform upgraded; it looks like some firewall rules didn't get ported to permit workspaces to talk to our external network;
I'm working on fixing it, should hopefully have some news later today.
Thanks for bringing this up!
Nathan Williams
Python Web Development Techdegree Student 6,851 Pointsmichael7williams, Paul Wagner, Jesse Zelaya, OK, this should be working now. Can you confirm?
michael7williams
9,638 PointsConfirmed. Thank you!
Nathan Williams
Python Web Development Techdegree Student 6,851 PointsNo problem, thanks again for raising this up, and sorry for the hassle. And please, don't hesitate to reach out to us if you ever run into trouble!
Jesse Zelaya
13,599 PointsJesse Zelaya
13,599 PointsI think there might be an issue with Treehouse's console. I have the same problem when I try to run my javascript file in it.