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

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.