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.
Aakash Srivastava5,415 Points
Why do we use Node.js and not AJAX?
Why are we using Node here instead of AJAX? Why do we need to create a webserver? Does it mean each website user has a webserver created for him?
It feels like Node.js basic course has left me with lots of holes, and the documentation is just plain "how" and not "why"
Why are we using Node here instead of AJAX?
AJAX is used to make client-side code communicate with a server, it doesn't serve much use if you don't have a server to communicate with, which is where Node.js comes in. As such AJAX and Node.js are not alternatives to each other, they are in fact often used together.
Why do we need to create a webserver?
To serve your page, and to run code that is to sensitive to run on a client.
Does it mean each website user has a webserver created for him?
No, all users are directed at the same webserver instance, at least by default. On larger sites it is possible to have multiple servers setup to deal with a large amount of requests.