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 Build a Simple Dynamic Site with Node.js Handling Routes in Node.js Populating User Information

Brian Patterson
Brian Patterson
19,588 Points

Where does "profileJSON" come from.

Can someone explain to me where "profileJSON" is coming from?

1 Answer

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hey Brian,

I'm not sure if I completely understand your question. Sorry.

In the video that you have linked, Andrew is pulling the JSON data straight from the API (in this case, the API by Treehouse). Treehouse's API provides a JSON file for any student on Treehouse. You can just add .json to the end of the URL for your profile info to see the data.

But, depending on what information you are retrieving, it could come from anywhere. Weather information would come from some weather API (e.g. The Dark Sky API). Sports stats from someone's 'sport' API.
It's also good to know that sometimes not all APIs will offer the same information publically, and some will offer it in other formats (e.g. CSV files). In short, it is the API that provides the data from their database for you to retrieve and make use of.

You can read more on JSON FILES on the MDN.

Hope that helps.

Keep Coding! :) :dizzy:

Brian Patterson
Brian Patterson
19,588 Points

I think I understand it now. Having looked at your comment and others. Basically, we are creating a new object and assigning it to studentProfile. Then we are asking for the "end event" to be triggered. This is because we have "Body" of the API.

James Blazer
James Blazer
3,836 Points

I have the same question. The instructor says the object is coming from profileJSON but that isn't shown anywhere. So how would I know where this object is coming from or figure out the root of an object if I were to be getting an object from another site?