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 Node.js Basics (2014) Building a Command Line Application Preparation and Planning

node.js vs ajax?

our project is jsut to get student point and badges from the treehouse site. cant we just use ajax for that??? i cant tell the difference between the two. they both are performing the same function right now

why do we use console.log in node.js for everything?.

i also dont get why we are not doing the things instructor talked about in the start such as real time chat application/real time pokemon game.

Nathan Wakefield
Nathan Wakefield
7,065 Points

As far as why we aren't working on the examples he showed us, I think that's because he's easing us into Node.js. Those applications probably require a better knowledge of Node.js and aren't a very good way to teach beginners.

2 Answers

Brandon Kaufman
Brandon Kaufman
4,838 Points

Node.js allows code to be written on the server side. AJAX is apart of the front-end of website development. This means that you can use AJAX to send off requests to the server, but node can be written to process those requests and shoot back responses.

Do you always have to write the server side code to process specific ajax requests or can you write code in node.js that will handle any ajax request you give it?

Ryan Chatterton
Ryan Chatterton
5,914 Points

NodeJs is using the V8 engine. The same Javascript engine that Chrome uses. Some smart peeps extracted that engine which became NodeJs. NodeJs is a server. You handle everything. Sure you would write a page and call it with ajax javascript. But this is a basic example of what you can do with Node. Node is better for building endpoints (API's), task runners etc...