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 trial

Patrick Cooney
778 PointsError in node-basics http request - Moved Permanently
I was working through the node.js basics tutorial and had the app working fine. I tried to fire it up today, and keep getting 301 error on the http request.
I console logged the username(s) and url, and they seem to look perfectly fine, so I'm a little stumped. I noticed that when I put the url into my browser, it redirected to https. I tihnk that may be the cause, but I'm not 100% sure. Has anyone else experienced this error? Thanks !
2 Answers

akak
29,446 PointsHi Patrick!
Treehouse now use https everywhere. You need to change the require to https and change the address to https.
/*profile.js*/
var http = require("https"); //here
var url = "https://teamtreehouse.com/" + username + ".json"; // and here
This should be probably added to teacher's notes in the course if it isn't yet :)
Cheers!

leonardo castillo
13,570 PointsThanks, i was also going through the same problem as well.

roses
5,585 PointsShould the variable in the line of code in the above answer be "https" and not "http"? As in:
var https = require("https");

Patrick Cooney
778 PointsThanks ! Had initially tried https
in the url and got a kickback. Didn't realize there was a require for https
, but now i do ! Thanks again!
Patrick Cooney
778 PointsPatrick Cooney
778 PointsCode below:
And then i run something like
node app.js chalkers
and getThere was an error getting a profile for chalkers. (Moved Permanently)