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 Creating a Simple Server in Node.js Preparing & Planning

Why are we using node.js?

I still don't quite understand where node.js is coming for the simple node.js project. If all we are doing in initating an API call to get user profile information, why do we need a server? Aren't we just using HTML and Javascript for the client side and the Treehouse server for the server side?

Is there another reason for a node.js server?

2 Answers

Neil Anuskiewicz
Neil Anuskiewicz
11,007 Points

I think it's because Node.js is by definition server side as opposed to client side JavaScript. I remember doing the app you're talking about that pulled student profile data. I ran it from a Unix shell as opposed to in a browser just to play with it but normally a Node app would have an event call it rather than someone running it manually.

Check out Node.js. This is JavaScript decoupled from the client side. Think of the potential from server side applications to refrigerator side applications. Maybe your toaster will have an API. :-)

fngr
fngr
11,179 Points

I think Eric is right.. I mean, in this particular scenario: wouldn't it be much easier to do this with just some easy ajax request via jQuery or something like that? Or is it because we want to have our own profile pages with URLs? In this case, wouldn't it be cooler to create our own i.e. mongodb database to reach the data of the students? some example students?