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

Peter Retvari
seal-mask
.a{fill-rule:evenodd;}techdegree
Peter Retvari
Full Stack JavaScript Techdegree Student 8,392 Points

Why do we need to create a webserver?

Hi folks, I'm a little bit confused with this project: build a simple dynamic site with Node.js. In generally I understand these concepts:

1) Why we are using AJAX? => because it's a non-blocking language and we can use Javascript and don't have to learn PHP or something, and it's also quick, easy and effective. Got it.

2) Why we have to use server in general? => because you can't run a website without a server :) you need to store your clients data, you need to protect it and hide it from the clients as well. Got it.

But... in this case(build dynamic website...) if we are accessing the student's data trough www.teamtreehouse.com and we are sending request to the treehouse's web server, WHY WE HAVE TO BUILD OUR OWN WEB-SERVER if we just request data from treehouse and display it in a fancy environment in the browser with html and css?

Am I wrong? I just started this part of the course, but I wanted to clear it before I dive deep into it.

1 Answer

Ceil-Ian Maralit
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Ceil-Ian Maralit
Front End Web Development Techdegree Graduate 19,422 Points

Hi Peter,

I believe your question is why do we need our to build our own server rather than just using other’s, right? There is a lot of factors to consider here but let me just lay a few...

We need to have our own server because this example of this course is not always the case in real life.

When putting something in your website and it is a vital part of it, you may not want to depend on other server by requesting everytime someone requests for your website, because this can affect performance.

Did you know that when you request a lot on google maps and made their service slow, they will charge you money? :) same as the other if you will depend mainly on them, if they won’t charge you, they will terminate their service for you. This a factor to consider that you don’t know how many people will use your website or app, the server could get overwhelmed.

Plus, if the server you are relying on goes down, your whole project goes down too because you have that as the most vital part of your project. Not unless it’s not that important.

I hope this helps!

Best, —Ceil