Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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. :-)

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?