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

Nina Kozlova
Nina Kozlova
11,602 Points

statusCode 301

Following the video as instructed, I get statusCode 301. I have looked up related forum topics and the suggestion was to change http to https. Tried that and got 404. Please help.

4 Answers

Treehouse is sending you a redirect status of 301 since the correct protocol is https and not http. To use http, you need to use the NODE.js https object instead of http. So, the code looks like this.

var https = require("https"); ... var request = https.get("https://teamtreehouse.com" ...

Atrian Wagner
Atrian Wagner
24,811 Points

Thank you! I was having the same issue, and this fixed it!

I suppose teamtreehouse could possibly update their video to reflect the change? If that's not too much trouble.

Nina Kozlova
Nina Kozlova
11,602 Points

Thank you, Ron, it worked with https the next day for some reason. Got that sorted out a long time ago but I do appreciate your response all the same.

Ron thanks for the help this was driving me bonkers

Hi Ben. I am happy my answer helped.