JavaScript as Server: Node.js

Contact Us or call 1-877-932-8228
JavaScript as Server: Node.js

JavaScript on the Server Side?

Given that in this course we will be using JavaScript (in the form of Node.js) for some of the server-side components, we're going to examine how it all works. Please use this section as a quick guide on how to run the demos and exercises you see later in the course; we've also included some background on Node.js, but you can skim that if you aren't interested.

Node.js is a "platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices." Much like PHP, ColdFusion, Microsoft .NET, or JavaServer Pages, Node.js (pronounced to rhyme with "Toad Say Yes") is an application server. You might use Node.js to connect to a database (returning a result set from a query, say, or updating a record); deliver HTML, XML, or JSON content; connect to local files; or serve up static web pages like Apache or another web server.

Why Node.js?

Since you write Ajax code in JavaScript throughout this course, it made sense to choose a server-side technology also based in JavaScript; as such, we picked Node.js - perhaps the most stable and most prevalent of the JavaScript-based server-side solutions that have gained in popularity over the past decade.

A useful byproduct of the move to Node.js is consistency: It used to be the case that we presented this course to students with a choice of server-side technologies (Classic ASP, ColdFusion, PHP, and JSP) and asked them to set one of these up on their computer. We need the server-side technologies to serve up database-query pages (since the Ajax pages have to query something in the background to get, and thus return, some content). But given the differences among students's setups - PC vs. Mac, personal laptop vs. corporate network station, etc. - we found that setting up Node.js offered an easy way to provide server-side resources in a consistent manner for all students.