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

Thomas Euget
Thomas Euget
10,615 Points

javascripts/node js/meteor questions

Couple of questions to make sure I understand everything:

When making a website you will put on a given server your html, css, javascript, php files. When a client wants to go on your domain, the server will send all those files to the client browser and will interpret them? Apache's work is then only to find and send the files, why would it interpret it as said on the video?

Node JS is "server side javascript" that helps you create routes, communicate with the database and so forth. Does that mean that Apache needs to be able to compile node js as well?

Node JS is a JavaScript runtime. What does it precisely mean? Does it mean that it is designed to be able to compile itself on the server? In case how does that work?

All AJAX can be covered with Node JS correct?

Final question, on the client side, we should just use standard javascript/jquery in order to create animated content, but how about something like Meteor that combines both client and server side? is it a combination of Node JS and JavaScript?

Thanks vm in advance!! Thomas

For an Apache server with HTML, CSS, JavaScript, and PHP files.

A client that reaches the server may indeed get HTML, CSS, JavaScript files served as-is from Apache. The file that was on the server is exactly what the client will get.

In the case of a PHP file, it will first be interpreted by the server so the server can figure out variables, if statements and so on. Only the results of interpreting the PHP file will be sent to the client. This means that the client can never see a database password stored in the PHP file on the server for example. The client will only receive HTML that was made by the PHP file on the server and not the original PHP file itself.

Or to think of things another way... you can be sure to setup PHP on your server but you could not be sure that all clients could understand how to interpret raw PHP files if you sent those to them. :)