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 Building a Command Line Application Requesting data with https

Issue with code

Hey there

Am running through some refresher courses and think there is a problem with how this project is setup. I'm following the code as is and two issues: 1 - the profile for "csalgado" as in the video seems to be down completely when I try and visit the URL 2 - when replacing the profile url with my own profile I get a 302 error.

I can see a tech report response from 2 years ago explaining that the URLs were migrated without the json response. Was this ever updated?

This is my code, for reference:

const https = require("https"); function getProfile() { // Connect to the API url (https://teamtreehouse.com/profiles/csalgado.json) const request = https.get( "https://teamtreehouse.com/profiles/csalgado.json", (response) => { console.dir(response.statusCode); } ); } //Read the data

//Parse the data

// Print the data

getProfile();

I've tried this both with and without the /profiles/ in the URL. I can see the JSON response by visiting the page, so all I can assume here is that something has changed? Not sure what else I could be doing wrong here

Thanks

1 Answer

Steven Parker
Steven Parker
230,946 Points

Apparently, "csalgado" is no longer a user in the Treehouse system. And your own profile is set to be private in the privacy settings, so the system will not respond to a profile request.

Try using any currently valid user with a public profile instead (like mine, for example).