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 Handling Errors in Node

Nathan Reginato
Nathan Reginato
5,991 Points

Hi there, I am currently working on this Node.js class and I seem to be getting a different status code.

Where I am expecting the output 200, I keep seeing 301. I looked up this error and can't seem to fix it. I've reviewed my code and It seems to match perfectly with what I'm seeing in the video.

2 Answers

Seth Kroger
Seth Kroger
56,414 Points

The Treehouse web site switched to using only https since that course was released so you'll need to use that for your requests instead. See the answers here: https://teamtreehouse.com/community/301-error-with-http-not-https for more.

Change your first line to var https = require("https");

Change var request = https...

You should now get a 200 status code instead of 301.