Node.js Web Development

Author of:

Node Web Development

Author of

Subscribe in a reader

Enter your email address:

Delivered by FeedBurner

How do you choose between Node.js or other web application technologies?

There are plenty of new server side web application development technologies being developed. With the blizzard of choices before us, how do you choose between one or another? Will the newly hot web app technology really take off, or will it fizzle in a few years? For example, Node.js is getting a lot of excitement, but what about Go, or what about the mature platforms like PHP/Symfony or CakePHP?

Easily offload your CPU-intensive Node.js code with simple Express-based REST server

nodejs-dark.pngNode.js is horrible with CPU bound processing, supposedly. Why? Because CPU-intensive algorithms block the event loop from handling events, blocking the Node.js platform from doing its core competency. Actually, as I demonstrate in my book Node Web Development (see sidebar for link), it's possible to use "setImmediate" to dispatch work through the Node.js event loop, and perform intensive computation while not blocking the event loop.

Unit testing Express route handlers in isolation from everything, including Express

nodejs-dark.pngWhen we write unit tests it's good practice to "mock" out extraneous bits to the code being tested. It's almost like the scientific method in that testing, in the unit testing paradigm, means exercising each small portion of your code in isolation if only to eliminate unwanted variables. While there are other testing paradigms, unit testing has its value. A big question for Node.js web application programmers is - how do you mock out HTTP requests for unit testing?

Progress on jQuery-style templates for AkashaCMS (Mahabhuta)

Since last weekend I've been working on Mahabhuta, the new element-oriented template system using jQuery's API, in AkashaCMS. The goal was to verify that it's useful by attempting to implement some important things with it. I'm happy to say that Mahabhuta is living up to what I hoped. I've been able to reduce complexity in AkashaCMS and the path is clear to perhaps removing the Kernel template engine, because the functionality I sought with Kernel is now available via Mahabhuta.

Major change in AkashaCMS - new model for rendering content, and jQuery as a template engine

I'm about to release an AkashaCMS v0.3.x update that represents a major rewrite of the rendering system, and the addition of support to use the jQuery API on the server side to manipulate rendered pages. Both of the changes are major, and take AkashaCMS to a new level of flexibility. First, Website authors will be able to use any combination of template engine on each page, giving better flexibility over page formatting.

Avoid tearing your hair out on variable values in deeply nested JavaScript/Node.js callback chains

JavaScript, and hence Node.js, supports a useful model for variable scoping and callback functions where the available variables build up as the code nests. It's very convenient because your code doesn't have to pass values through function parameters to code in an in-line callback function. But it's possible for a variable to not have the expected value by the time the callback function executes. When that's the case, it's tempting to start tearing your hair out in frustration screaming about the variable's value is incorrect.

JavaScript doesn't tell you the Date object is bad, here's how to figure that out before crashing your program

In JavaScript, creating a Date object from a string is real convenient ("var foo = new Date(dateString)"), but what if dateString has a bad format? How will your code know about this? The Date object doesn't have a getter to tell you the date is bad.

Viewer.js, a powerful pure-JavaScript document viewer to simplify your visitors document experience

I hate the typical user experience around viewing and distributing PDF files (or other document formats). Usually we're forced to download the file to our local computer, then view it using a separate viewer. It litters the Downloads directory with old files we've downloaded, and it's somewhat jarring to find yourself suddenly having to navigate to a separate viewer application. Further, an external viewer probably doesn't work well on a mobile device where the operating paradigm is quite different from desktop computers.

Static HTML website builders (AkashaCMS, etc) slashes web hosting costs to the bone

Today's web is supposedly about fancy software on both server and client, building amazingly flexible applications merging content and functionality from anywhere.  What, then, is the role of old-school HTML websites?  In particular, why am I wasting my time building AkashaCMS and not building websites with Drupal?

AkashaCMS v0.3.0 released - major rearchitecting, plugins, improvements, much more planned for v0.4.x

I'm pleased to announce that AkashaCMS has reached version 0.3.0.  This version has been over a year in development and isn't quite what I'd intended, but it is a result of the actual needs during the past year.  The primary change was to architect AkashaCMS to support plugins, a move which allowed the creation of several useful plugins.